(maint) Add optional_parameter_count method to Closure

Add a method to return number of optional parameters on
Puppet::Pops::Evaluator::Closure just like Puppet::Parser::AST::Lambda
has.
(maint) Fix syntax error in example code
(maint) Change name from from_pson to from_data_hash

This is because these methods are also used for deserialization from
other formats than PSON. The method for serializing a object is called
to_data_hash, so makes sense to call this from_data_hash.
(maint) Deprecate from_pson methods

They have all been replaced with from_data_hash methods instead.
(maint) Unify to_pson in FormatSupport module, just like with to_msgpack

This removes all unnecessary to_pson definitions and creates a common
one in the Puppet::Network::FormatSupport module instead just like with
to_msgpack.

There are still some to_pson definitions left but that is because they
also add a document type structure. That cannot be removed until the
next major version as it would change the on wire format.
(maint) Simplify msgpack format code
(PUP-1029) Add Enumeration - common place to produce an Enumerator.

The support for creating an Enumerator was in different places
(in each of the iterative functions, and in the type calculator).

This commit break out the behavior to a common class; Enumeration.
(PUP-1029) Make filter function use common Enumeration support.

This makes the filter function use the common Enumeration support
and makes it consistent with how all iterative functions should behave.

The function's documentation is also updated.
(PUP-1029) Make map function use common Enumeration support.

This makes the map function use the common Enumeration support.
(PUP-1029) Make each function use the Enumeration support.

This makes the each function use the common Enumeration support.
Documentation is also updated.
(PUP-1029) Make reduce functon use common Enumeration support.

This makes the reduce function use the common Enumeration support.
Documentation is updated.
Merge pull request #2310 from dalen/serialization_revamp

Serialization revamp
Merge pull request #2330 from dalen/maint_application_comment

(maint) Fix syntax error in example code
(PUP-1029) Make the slice function use the common Enumeration support.

This adds use of the common Enumeration support to the slice function.
The documentation of the function is also updated.
(PUP-1029) Fix problem with class Enumerator btw. 1.8.7 and 1.9.3

The Enumerator class is in Enumerable::Enumerator in 1.8.7, and is
global from 1.9.3. 

This changes the tests to check if result responds to :next instead.
Merge pull request #2314 from dalen/lambda_optional_param_count

(maint) Add optional_parameter_count method to Closure
(PUP-1574) Environment setting does not override apply/parser manifest

Both `puppet apply` and `puppet parser validate` were relying on the
legacy environment behavior to implicit draw in the setting of
Puppet[:manifest].  But the new directory environments do not pay
attention to Puppet[:manifest] and thus a call such as `puppet apply
foo.pp --environment dir_env` would not apply foo.pp if dir_env was in
the $environmentpath.

This change explicitly creates a new environment based off the currently
configured environment and overrides with the manifest this to be
applied or validated.
Merge pull request #2334 from jpartlow/issue/master/pup-1574-dir-envs-prevent-applying-cmdline-manifest

(PUP-1574) Environment setting does not override apply/parser manifest
(PUP-1029) Fix problem with Enumerator for String chars on Ruby 2.0.0

Ruby 2.0.0 does not return an Enumerator when calling String#chars,
instead an Array with the characters is returned.

Ruby 1.8.7 returns Enumerable::Enumerator, and 1.9.3 returns Enumerator.

Long live API stability !
Merge pull request #2332 from hlindberg/pup-1029_filter-function-serving-size

(PUP-1029) Make iterative functions more consistent