Class: PuppetStrings::Yard::Parsers::Puppet::ParameterizedStatement::Parameter

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

Overview

Implements a parameter for a parameterized statement.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parameter) ⇒ Parameter

Initializes the parameter.

Parameters:

  • parameter (Puppet::Pops::Model::Parameter)

    The parameter model object.



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 84

def initialize(parameter)
  @name = parameter.name
  # Take the exact text for the type expression
  if parameter.type_expr
    adapter = ::Puppet::Pops::Adapters::SourcePosAdapter.adapt(parameter.type_expr)
    @type = adapter.extract_text
  end
  # Take the exact text for the default value expression
  if parameter.value
    adapter = ::Puppet::Pops::Adapters::SourcePosAdapter.adapt(parameter.value)
    @value = adapter.extract_text
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



78
79
80
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 78

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



79
80
81
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 79

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



80
81
82
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 80

def value
  @value
end