class PuppetStrings::Yard::CodeObjects::Task
Implements the Puppet
task code object.
Attributes
Public Class Methods
Source
# 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
Initializes a JSON task code object. @param statement TaskStatement object @return [void]
Calls superclass method
PuppetStrings::Yard::CodeObjects::Base::new
Public Instance Methods
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
# File lib/puppet-strings/yard/code_objects/task.rb, line 42 def source @statement.source end
Gets the source of the code object. @return Returns the source of the code object.
Source
# 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
Converts the code object to a hash representation. @return [Hash] Returns a hash representation of the code object.
Source
# File lib/puppet-strings/yard/code_objects/task.rb, line 36 def type :puppet_task end
Gets the type of the code object. @return Returns the type of the code object.