hlindberg/puppet — pull request #23 by thallgren (2013-06-26 11:28:00+00:00)
Title: Make a clear distinction between types and instances of types

This commit adds two public methods to the TypeCalculator and a slew
of more unit tests. It also changes the behavior of the assignable?
method slightly to make it more stringent about types and instances.

The new method instance?(t, o) answers the question "is the object o
an instance of the Puppet Type t". This method is necessary since
the assignable?(t, t2) method no longer infers the type of its
second argument. Instead it will always assume that both arguments
are either Puppet types or ruby classes and it will convert any ruby
class into its corresponding Puppet Type using the new method
for_ruby_class(c).

This new method returns the Puppet Type for the given Ruby class. It
will return PType for the ruby class 'Class' and 'Array' and 'Hash'
are assumed to be array of data and hash with literal keys and data
values.