class PuppetStrings::Yard::CodeObjects::Plan
Implements the Puppet
plan code object.
Attributes
parameters[R]
statement[R]
Public Class Methods
new(statement)
click to toggle source
Initializes a Puppet
plan code object. @param [PuppetStrings::Parsers::PlanStatement] statement The plan statement that was parsed. @return [void]
Calls superclass method
PuppetStrings::Yard::CodeObjects::Base::new
# File lib/puppet-strings/yard/code_objects/plan.rb, line 28 def initialize(statement) @statement = statement @parameters = statement.parameters.map { |p| [p.name, p.value] } super(PuppetStrings::Yard::CodeObjects::Plans.instance, statement.name) end
Public Instance Methods
source()
click to toggle source
Gets the source of the code object. @return Returns the source of the code object.
# File lib/puppet-strings/yard/code_objects/plan.rb, line 42 def source @statement.source end
to_hash()
click to toggle source
Converts the code object to a hash representation. @return [Hash] Returns a hash representation of the code object.
# File lib/puppet-strings/yard/code_objects/plan.rb, line 48 def to_hash hash = {} hash[:name] = name hash[:file] = file hash[:line] = line hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring) defaults = Hash[*parameters.reject { |p| p[1].nil? }.flatten] hash[:defaults] = defaults unless defaults.nil? || defaults.empty? hash[:source] = source unless source.nil? || source.empty? hash end
type()
click to toggle source
Gets the type of the code object. @return Returns the type of the code object.
# File lib/puppet-strings/yard/code_objects/plan.rb, line 36 def type :puppet_plan end