class PuppetStrings::Yard::CodeObjects::Task
Implements the Puppet
task code object.
Attributes
statement[R]
Public Class Methods
new(statement)
click to toggle source
Initializes a JSON task code object. @param statement TaskStatement object @return [void]
Calls superclass method
PuppetStrings::Yard::CodeObjects::Base::new
# File lib/puppet-strings/yard/code_objects/task.rb, line 28 def initialize(statement) @name = statement.name @statement = statement super(PuppetStrings::Yard::CodeObjects::Tasks.instance, name) end
Public Instance Methods
parameters()
click to toggle source
# File lib/puppet-strings/yard/code_objects/task.rb, line 46 def parameters statement.parameters.map do |name, props| { name: name.to_s, tag_name: 'param', text: props['description'] || '', types: [props['type']] || '' } end end
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/task.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/task.rb, line 57 def to_hash { name: name.to_s, file: statement.file, line: statement.line, docstring: { text: statement.docstring, tags: parameters }, source: statement.source, supports_noop: statement.json['supports_noop'] || false, input_method: statement.json['input_method'] } 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/task.rb, line 36 def type :puppet_task end