puppet-strings 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/lib/puppet-strings/rake_tasks.rb +18 -0
  3. data/lib/puppet/application/strings.rb +4 -0
  4. data/lib/puppet/face/strings.rb +64 -0
  5. data/lib/puppet/feature/rgen.rb +3 -0
  6. data/lib/puppet/feature/yard.rb +3 -0
  7. data/lib/puppet_x/puppetlabs/strings.rb +64 -0
  8. data/lib/puppet_x/puppetlabs/strings/actions.rb +92 -0
  9. data/lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb +79 -0
  10. data/lib/puppet_x/puppetlabs/strings/pops/yard_transformer.rb +47 -0
  11. data/lib/puppet_x/puppetlabs/strings/util.rb +65 -0
  12. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/defined_type_object.rb +33 -0
  13. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/host_class_object.rb +22 -0
  14. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/method_object.rb +62 -0
  15. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/provider_object.rb +24 -0
  16. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/puppet_namespace_object.rb +48 -0
  17. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/type_object.rb +42 -0
  18. data/lib/puppet_x/puppetlabs/strings/yard/core_ext/yard.rb +40 -0
  19. data/lib/puppet_x/puppetlabs/strings/yard/handlers/base.rb +13 -0
  20. data/lib/puppet_x/puppetlabs/strings/yard/handlers/defined_type_handler.rb +31 -0
  21. data/lib/puppet_x/puppetlabs/strings/yard/handlers/heredoc_helper.rb +80 -0
  22. data/lib/puppet_x/puppetlabs/strings/yard/handlers/host_class_handler.rb +42 -0
  23. data/lib/puppet_x/puppetlabs/strings/yard/handlers/provider_handler.rb +95 -0
  24. data/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb +54 -0
  25. data/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_4x_function_handler.rb +234 -0
  26. data/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb +295 -0
  27. data/lib/puppet_x/puppetlabs/strings/yard/json_registry_store.rb +85 -0
  28. data/lib/puppet_x/puppetlabs/strings/yard/monkey_patches.rb +68 -0
  29. data/lib/puppet_x/puppetlabs/strings/yard/parser.rb +30 -0
  30. data/lib/puppet_x/puppetlabs/strings/yard/tags/directives.rb +9 -0
  31. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/docstring.erb +34 -0
  32. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/header.erb +5 -0
  33. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/parameter_details.erb +6 -0
  34. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/setup.rb +1 -0
  35. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/setup.rb +49 -0
  36. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_class.erb +2 -0
  37. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb +1 -0
  38. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb +21 -0
  39. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_provider.erb +1 -0
  40. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_type.erb +1 -0
  41. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb +82 -0
  42. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/box_info.erb +22 -0
  43. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/setup.rb +1 -0
  44. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/subclasses.erb +4 -0
  45. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/setup.rb +21 -0
  46. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/html_helper.rb +139 -0
  47. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/layout/html/setup.rb +18 -0
  48. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/html/header.erb +17 -0
  49. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/setup.rb +21 -0
  50. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/text/header.erb +2 -0
  51. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/command_details.erb +8 -0
  52. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/confine_details.erb +10 -0
  53. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/default_details.erb +10 -0
  54. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/docstring.erb +34 -0
  55. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/feature_details.erb +10 -0
  56. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/header.erb +5 -0
  57. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/setup.rb +1 -0
  58. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb +50 -0
  59. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/box_info.erb +11 -0
  60. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/header.erb +5 -0
  61. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/method_details_list.erb +53 -0
  62. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/method_summary.erb +20 -0
  63. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/setup.rb +1 -0
  64. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/setup.rb +91 -0
  65. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/template_helper.rb +192 -0
  66. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/docstring.erb +34 -0
  67. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/header.erb +5 -0
  68. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/parameter_details.erb +12 -0
  69. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/provider_details.erb +10 -0
  70. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/setup.rb +1 -0
  71. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb +55 -0
  72. metadata +142 -0
@@ -0,0 +1,33 @@
1
+ require 'json'
2
+
3
+ class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::DefinedTypeObject < PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject
4
+ # A list of parameters attached to this class.
5
+ # @return [Array<Array(String, String)>]
6
+ attr_accessor :parameters
7
+ attr_accessor :type_info
8
+
9
+ def to_s
10
+ name.to_s
11
+ end
12
+
13
+ def to_json(*a)
14
+ {
15
+ "name" => @name,
16
+ "file" => file,
17
+ "line" => line,
18
+ "parameters" => Hash[@parameters],
19
+ "docstring" => Puppet::Util::Docs.scrub(@docstring),
20
+ "signatures" => @type_info.map do |signature|
21
+ signature.map do |key, value|
22
+ {
23
+ "name" => key,
24
+ "type" => value,
25
+ }
26
+ end
27
+ end,
28
+ "examples" => self.tags.map do |tag|
29
+ tag.text if tag.tag_name == 'example'
30
+ end.compact,
31
+ }.to_json(*a)
32
+ end
33
+ end
@@ -0,0 +1,22 @@
1
+ class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::HostClassObject < PuppetX::PuppetLabs::Strings::YARD::CodeObjects::DefinedTypeObject
2
+ # The {HostClassObject} that this class inherits from, if any.
3
+ # @return [HostClassObject, Proxy, nil]
4
+ attr_accessor :parent_class
5
+
6
+ # NOTE: `include_mods` is never used as it makes no sense for Puppet, but
7
+ # this is called by `YARD::Registry` and it will pass a parameter.
8
+ def inheritance_tree(include_mods = false)
9
+ if parent_class.is_a?(PuppetX::PuppetLabs::Strings::YARD::CodeObjects::HostClassObject)
10
+ # Cool. We got a host class. Return self + parent inheritance tree.
11
+ [self] + parent_class.inheritance_tree
12
+ elsif parent_class.is_a?(YARD::CodeObjects::Proxy)
13
+ # We have a reference to a parent that has not been created yet. Just
14
+ # return it.
15
+ [self, parent_class]
16
+ else
17
+ # Most likely no parent class. But also possibly an object that we
18
+ # shouldn't inherit from. Just return self.
19
+ [self]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,62 @@
1
+ class YARD::CodeObjects::MethodObject
2
+
3
+ # Override to_s and to_json methods in Yard's MethodObject so that they
4
+ # return output formatted as I like for puppet 3x and 4x methods.
5
+ def to_s
6
+ if self[:puppet_4x_function] || self[:puppet_3x_function]
7
+ name.to_s
8
+ else
9
+ super
10
+ end
11
+ end
12
+
13
+ def to_json(*a)
14
+ if self[:puppet_4x_function]
15
+ {
16
+ "name" => @name,
17
+ "file" => file,
18
+ "line" => line,
19
+ "function_api_version" => 4,
20
+ "docstring" => Puppet::Util::Docs.scrub(@docstring),
21
+ "examples" => self.tags.map do |tag|
22
+ tag.text if tag.tag_name == 'example'
23
+ end.compact,
24
+ "documented_params" => @parameters.map do |tuple|
25
+ {
26
+ "name" => tuple[0],
27
+ "type" => tuple[1],
28
+ }
29
+ end,
30
+ "signatures" => @type_info.map do |signature|
31
+ signature.map do |key, value|
32
+ {
33
+ "name" => key,
34
+ "type" => value,
35
+ }
36
+ end
37
+ end,
38
+ }.to_json(*a)
39
+ elsif self[:puppet_3x_function]
40
+ {
41
+ "name" => @name,
42
+ "file" => file,
43
+ "line" => line,
44
+ "function_api_version" => 3,
45
+ "docstring" => Puppet::Util::Docs.scrub(@docstring),
46
+ "documented_params" => @parameters.map do |tuple|
47
+ {
48
+ "name" => tuple[0],
49
+ "type" => tuple[1],
50
+ }
51
+ end,
52
+ "examples" => self.tags.map do |tag|
53
+ tag.text if tag.tag_name == 'example'
54
+ end.compact,
55
+ }.to_json(*a)
56
+ else
57
+ super
58
+ end
59
+ end
60
+
61
+
62
+ end
@@ -0,0 +1,24 @@
1
+ class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::ProviderObject < PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject
2
+ # A list of parameters attached to this class.
3
+ # @return [Array<Array(String, String)>]
4
+ attr_accessor :parameters
5
+
6
+ def to_json(*a)
7
+ {
8
+ "name" => @name,
9
+ "type_name" => @type_name,
10
+ "file" => file,
11
+ "line" => line,
12
+ "docstring" => Puppet::Util::Docs.scrub(@docstring),
13
+ "commands" => @commands,
14
+ "confines" => @confines,
15
+ "defaults" => @defaults,
16
+ "features" => @features,
17
+ "examples" => self.tags.map do |tag|
18
+ tag.text if tag.tag_name == 'example'
19
+ end.compact,
20
+ }.to_json(*a)
21
+ end
22
+
23
+
24
+ end
@@ -0,0 +1,48 @@
1
+ class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject < YARD::CodeObjects::NamespaceObject
2
+
3
+ attr_accessor :type_info
4
+ # NOTE: `YARD::Registry#resolve` requires a method with this signature to
5
+ # be present on all subclasses of `NamespaceObject`.
6
+ def inheritance_tree(include_mods = false)
7
+ [self]
8
+ end
9
+
10
+ def to_s
11
+ name.to_s
12
+ end
13
+
14
+ def to_json(*a)
15
+ {
16
+ "name" => @name,
17
+ "file" => file,
18
+ "line" => line,
19
+ "docstring" => @docstring,
20
+ "examples" => self.tags.map do |tag|
21
+ tag.text if tag.tag_name == 'example'
22
+ end.compact,
23
+ }.to_json(*a)
24
+ end
25
+
26
+ # FIXME: We used to override `self.new` to ensure no YARD proxies were
27
+ # created for namespaces segments that did not map to a host class or
28
+ # defined type. Fighting the system in this way turned out to be
29
+ # counter-productive.
30
+ #
31
+ # However, if a proxy is left in, YARD will drop back to namspace-mangling
32
+ # heuristics that are very specific to Ruby and which produce ugly paths in
33
+ # the resulting output. Need to find a way to address this.
34
+ #
35
+ # Tried:
36
+ #
37
+ # - Overriding self.new in the code object. Failed because self.new
38
+ # overrides are gross and difficult to pull off. Especially when
39
+ # replacing an existing override.
40
+ #
41
+ # - Adding functionality to the base handler to ensure something other
42
+ # than a proxy occupies each namespace segment. Failed because once a
43
+ # code object is created with a namespace, it will never update.
44
+ # Unless that namespace is set to a Proxy.
45
+ #
46
+ # def self.new(namespace, name, *args, &block)
47
+ end
48
+
@@ -0,0 +1,42 @@
1
+ class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::TypeObject < PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject
2
+ # A list of parameters attached to this class.
3
+ # @return [Array<Array(String, String)>]
4
+ attr_accessor :parameters
5
+
6
+ def to_json(*a)
7
+ {
8
+ "name" => @name,
9
+ "file" => file,
10
+ "line" => line,
11
+ "docstring" => Puppet::Util::Docs.scrub(@docstring),
12
+ "parameters" => @parameter_details.map do |obj|
13
+ {
14
+ "allowed_values" => obj[:allowed_values] ? obj[:allowed_values].flatten : [],
15
+ "default" => obj[:default],
16
+ "docstring" => Puppet::Util::Docs.scrub(obj[:desc] || ''),
17
+ "namevar" => obj[:namevar],
18
+ "name" => obj[:name],
19
+ }
20
+ end,
21
+ "examples" => self.tags.map do |tag|
22
+ tag.text if tag.tag_name == 'example'
23
+ end.compact,
24
+ "properties" => @property_details.map do |obj|
25
+ {
26
+ "allowed_values" => obj[:allowed_values] ? obj[:allowed_values].flatten : [],
27
+ "default" => obj[:default],
28
+ "docstring" => Puppet::Util::Docs.scrub(obj[:desc] || ''),
29
+ "name" => obj[:name],
30
+ }
31
+ end,
32
+ "features" => @features.map do |obj|
33
+ {
34
+ "docstring" => Puppet::Util::Docs.scrub(obj[:desc] || ''),
35
+ "methods" => obj[:methods],
36
+ "name" => obj[:name],
37
+ }
38
+ end,
39
+ }.to_json(*a)
40
+ end
41
+
42
+ end
@@ -0,0 +1,40 @@
1
+ require 'yard'
2
+
3
+ require 'puppet_x/puppetlabs/strings'
4
+
5
+ # Patch the regular expression used to match namespaces
6
+ # so it will allow namespace segments that begin with
7
+ # both uppercase and lowercase letters (i.e. both
8
+ # Puppet::Namespace and puppet::namespace)
9
+ YARD::CodeObjects.send(:remove_const, :CONSTANTMATCH)
10
+ YARD::CodeObjects::CONSTANTMATCH = /[a-zA-Z]\w*/
11
+
12
+ # This is a temporary hack until a new version of YARD is
13
+ # released. We submitted a patch to YARD to add the
14
+ # CONSTANTSTART constant so that we could patch it and
15
+ # successfully match our own namesapces. However until
16
+ # the next version of the YARD gem is released, we must
17
+ # patch the problematic method itself as it is not yet
18
+ # using the added variable
19
+ if defined? YARD::CodeObjects::CONSTANTSTART
20
+ YARD::CodeObjects.send(:remove_const, :CONSTANTSTART)
21
+ YARD::CodeObjects::CONSTANTSTART = /^[a-zA-Z]/
22
+ else
23
+ class YARD::CodeObjects::Proxy
24
+ def proxy_path
25
+ if @namespace.root?
26
+ (@imethod ? YARD::CodeObjects::ISEP : "") + name.to_s
27
+ elsif @origname
28
+ if @origname =~ /^[a-zA-Z]/
29
+ @origname
30
+ else
31
+ [namespace.path, @origname].join
32
+ end
33
+ elsif name.to_s =~ /^[a-zA-Z]/ # const
34
+ name.to_s
35
+ else # class meth?
36
+ [namespace.path, name.to_s].join(YARD::CodeObjects::CSEP)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,13 @@
1
+ require 'puppet_x/puppetlabs/strings/yard/core_ext/yard'
2
+
3
+ class PuppetX::PuppetLabs::Strings::YARD::Handlers::Base < ::YARD::Handlers::Base
4
+ # Easy access to Pops model objects for handler matching.
5
+ include Puppet::Pops::Model
6
+ # Easy access to custom code objects from which documentation is generated.
7
+ include PuppetX::PuppetLabs::Strings::YARD::CodeObjects
8
+
9
+ def self.handles?(statement)
10
+ handlers.any? {|h| h == statement.type}
11
+ end
12
+
13
+ end
@@ -0,0 +1,31 @@
1
+ class PuppetX::PuppetLabs::Strings::YARD::Handlers::DefinedTypeHandler < PuppetX::PuppetLabs::Strings::YARD::Handlers:: Base
2
+ handles ResourceTypeDefinition
3
+
4
+ process do
5
+ obj = DefinedTypeObject.new(:root, statement.pops_obj.name) do |o|
6
+ o.parameters = statement.parameters.map do |a|
7
+ param_tuple = [a[0].pops_obj.name]
8
+ param_tuple << ( a[1].nil? ? nil : a[1].source )
9
+ end
10
+ end
11
+ tp = Puppet::Pops::Types::TypeParser.new
12
+ param_type_info = {}
13
+ statement.pops_obj.parameters.each do |pop_param|
14
+ # If the parameter's type expression is nil, default to Any
15
+ if pop_param.type_expr == nil
16
+ param_type_info[pop_param.name] = Puppet::Pops::Types::TypeFactory.any()
17
+ else
18
+ begin
19
+ param_type_info[pop_param.name] = tp.interpret_any(pop_param.type_expr)
20
+ rescue Puppet::ParseError => e
21
+ # If the type could not be interpreted insert a prominent warning
22
+ param_type_info[pop_param.name] = "Type Error: #{e.message}"
23
+ end
24
+ end
25
+ end
26
+ obj.type_info = [param_type_info]
27
+
28
+
29
+ register obj
30
+ end
31
+ end
@@ -0,0 +1,80 @@
1
+ class HereDocHelper
2
+ # NOTE: The following methods duplicate functionality from
3
+ # Puppet::Util::Reference and Puppet::Parser::Functions.functiondocs
4
+ #
5
+ # However, implementing this natively in YARD is a good test for the
6
+ # feasibility of extracting custom Ruby documentation. In the end, the
7
+ # existing approach taken by Puppet::Util::Reference may be the best due to
8
+ # the heavy use of metaprogramming in Types and Providers.
9
+
10
+ # Extracts the Puppet function name and options hash from the parsed
11
+ # definition.
12
+ #
13
+ # @return [(String, Hash{String => String})]
14
+ def process_parameters(statement)
15
+ # Passing `false` to prameters excludes the block param from the returned
16
+ # list.
17
+ name, opts = statement.parameters(false).compact
18
+
19
+ name = process_element(name)
20
+
21
+ # Don't try to process options if we don't have any
22
+ if !opts.nil?
23
+ opts = opts.map do |tuple|
24
+ # Jump down into the S-Expression that represents a hashrocket, `=>`,
25
+ # and the values on either side of it.
26
+ tuple.jump(:assoc).map{|e| process_element(e)}
27
+ end
28
+
29
+ options = Hash[opts]
30
+ else
31
+ options = {}
32
+ end
33
+
34
+ [name, options]
35
+ end
36
+
37
+ # Sometimes the YARD parser returns Heredoc strings that start with `<-`
38
+ # instead of `<<-`.
39
+ HEREDOC_START = /^<?<-/
40
+
41
+ def is_heredoc?(str)
42
+ HEREDOC_START.match(str)
43
+ end
44
+
45
+ # Turns an entry in the method parameter list into a string.
46
+ #
47
+ # @param ele [YARD::Parser::Ruby::AstNode]
48
+ # @return [String]
49
+ def process_element(ele)
50
+ ele = ele.jump(:ident, :string_content)
51
+
52
+ case ele.type
53
+ when :ident
54
+ ele.source
55
+ when :string_content
56
+ source = ele.source
57
+ if is_heredoc? source
58
+ process_heredoc(source)
59
+ else
60
+ source
61
+ end
62
+ end
63
+ end
64
+
65
+ # Cleans up and formats Heredoc contents parsed by YARD.
66
+ #
67
+ # @param source [String]
68
+ # @return [String]
69
+ def process_heredoc(source)
70
+ source = source.lines.to_a
71
+
72
+ # YARD adds a line of source context on either side of the Heredoc
73
+ # contents.
74
+ source.shift
75
+ source.pop
76
+
77
+ # This utility method normalizes indentation and trims whitespace.
78
+ Puppet::Util::Docs.scrub(source.join)
79
+ end
80
+ end
@@ -0,0 +1,42 @@
1
+ class PuppetX::PuppetLabs::Strings::YARD::Handlers::HostClassHandler < PuppetX::PuppetLabs::Strings::YARD::Handlers::Base
2
+ handles HostClassDefinition
3
+
4
+ process do
5
+ obj = HostClassObject.new(:root, statement.pops_obj.name)
6
+
7
+ obj.parameters = statement.parameters.map do |a|
8
+ param_tuple = [a[0].pops_obj.name]
9
+ param_tuple << ( a[1].nil? ? nil : a[1].source )
10
+ end
11
+ tp = Puppet::Pops::Types::TypeParser.new
12
+ param_type_info = {}
13
+ statement.pops_obj.parameters.each do |pop_param|
14
+ # If the parameter's type expression is nil, default to Any
15
+ if pop_param.type_expr == nil
16
+ param_type_info[pop_param.name] = Puppet::Pops::Types::TypeFactory.any()
17
+ else
18
+ begin
19
+ # This is a bit of a hack because we were using a method that was previously
20
+ # API private. See PDOC-75 for more details
21
+ if Puppet::Pops::Types::TypeParser.instance_method(:interpret_any).arity == 2
22
+ param_type_info[pop_param.name] = tp.interpret_any(pop_param.type_expr, nil)
23
+ else
24
+ param_type_info[pop_param.name] = tp.interpret_any(pop_param.type_expr)
25
+ end
26
+ rescue Puppet::ParseError => e
27
+ # If the type could not be interpreted insert a prominent warning
28
+ param_type_info[pop_param.name] = "Type Error: #{e.message}"
29
+ end
30
+ end
31
+ end
32
+ obj.type_info = [param_type_info]
33
+
34
+ statement.pops_obj.tap do |o|
35
+ if o.parent_class
36
+ obj.parent_class = P(:root, o.parent_class)
37
+ end
38
+ end
39
+
40
+ register obj
41
+ end
42
+ end