Class: Habaki::Value

Inherits:
Node
  • Object
show all
Defined in:
lib/habaki/value.rb

Overview

abstract value type

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#to_s

Constructor Details

#initialize(data = nil) ⇒ Value

Returns a new instance of Value.



7
8
9
# File 'lib/habaki/value.rb', line 7

def initialize(data = nil)
  @data = data
end

Instance Attribute Details

#data::String, Float

Returns:

  • (::String, Float)


5
6
7
# File 'lib/habaki/value.rb', line 5

def data
  @data
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
# File 'lib/habaki/value.rb', line 11

def ==(other)
  to_s == other.to_s
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/habaki/value.rb', line 15

def eql?(other)
  to_s.eql?(other.to_s)
end

#hashObject



19
20
21
# File 'lib/habaki/value.rb', line 19

def hash
  to_s.hash
end

#read_from_katana(val) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:



32
33
34
# File 'lib/habaki/value.rb', line 32

def read_from_katana(val)
  @data = val.value
end

#string(format = Formatter::Base.new) ⇒ String

Parameters:

Returns:



25
26
27
# File 'lib/habaki/value.rb', line 25

def string(format = Formatter::Base.new)
  "#{@data}"
end