Class: PuppetStrings::Yard::Parsers::Puppet::FunctionStatement

Inherits:
ParameterizedStatement show all
Defined in:
lib/puppet-strings/yard/parsers/puppet/statement.rb

Overview

Implements the Puppet function statement.

Constant Summary

Constants inherited from Statement

Statement::COMMENT_REGEX

Instance Attribute Summary collapse

Attributes inherited from ParameterizedStatement

#parameters

Attributes inherited from Statement

#comments_range, #docstring, #file, #line, #source

Instance Method Summary collapse

Methods inherited from Statement

#comments, #comments_hash_flag, #extract_docstring, #show

Constructor Details

#initialize(object, file) ⇒ FunctionStatement

Initializes the Puppet function statement.

Parameters:

  • object (Puppet::Pops::Model::FunctionDefinition)

    The model object for the function statement.

  • file (String)

    The file containing the statement.



134
135
136
137
138
139
140
141
142
143
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 134

def initialize(object, file)
  super
  @name = object.name
  return unless object.respond_to? :return_type

  type = object.return_type
  return unless type

  @type = PuppetStrings::Yard::Util.ast_to_text(type).gsub('>> ', '')
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



129
130
131
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 129

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



129
130
131
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 129

def type
  @type
end