Class: Puppet4xFunctionHandler
- Inherits:
-
YARD::Handlers::Ruby::Base
- Object
- YARD::Handlers::Ruby::Base
- Puppet4xFunctionHandler
- Defined in:
- lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_4x_function_handler.rb
Instance Method Summary collapse
-
#extract_type_from_command(command) ⇒ Object
Given a command node which represents code like this: param ‘Optional’, :value_type Extract the type name and type signature and return them as a array.
Instance Method Details
#extract_type_from_command(command) ⇒ Object
Given a command node which represents code like this: param ‘Optional’, :value_type Extract the type name and type signature and return them as a array.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_4x_function_handler.rb', line 29 def extract_type_from_command command return [] if command.children.length < 2 or command.children[1].children.length < 2 type_specifier = command.children[1] # the parameter signature is the first child of the specifier and an # identifier. Jump to the content inside the quotes and convert it to a # string. param_signature = type_specifier.children[0].jump(:tstring_content).source # The parameter name is the second child of the specifier and a symbol. # convert it to a string. param_name_ident = type_specifier.jump :ident return [] if param_name_ident == type_specifier param_name = param_name_ident.source [param_name, param_signature] end |