Class: Puppet::Pops::PN::Literal

Inherits:
Object
  • Object
show all
Includes:
Puppet::Pops::PN
Defined in:
lib/puppet/pops/pn.rb

Constant Summary

Constants included from Puppet::Pops::PN

KEY_PATTERN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Puppet::Pops::PN

#==, #as_call, #as_parameters, #double_quote, #format_elements, #pnError, #to_s, #with_name

Constructor Details

#initialize(value) ⇒ Literal

Returns a new instance of Literal.



177
178
179
# File 'lib/puppet/pops/pn.rb', line 177

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)



175
176
177
# File 'lib/puppet/pops/pn.rb', line 175

def value
  @value
end

Instance Method Details

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)


191
192
193
# File 'lib/puppet/pops/pn.rb', line 191

def eql?(o)
  o.is_a?(Literal) && @value == o.value
end

#format(indent, b) ⇒ Object



181
182
183
184
185
186
187
188
189
# File 'lib/puppet/pops/pn.rb', line 181

def format(indent, b)
  if @value.nil?
    b << 'nil'
  elsif value.is_a?(String)
    double_quote(value, b)
  else
    b << value.to_s
  end
end

#to_dataObject



195
196
197
# File 'lib/puppet/pops/pn.rb', line 195

def to_data
  @value
end