Class: Kumi::Core::IRV2::Value

Inherits:
Object
  • Object
show all
Defined in:
lib/kumi/core/irv2/value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, op, args, attrs, stamp: nil, elem_stamps: nil) ⇒ Value

Returns a new instance of Value.



11
12
13
14
15
16
17
18
# File 'lib/kumi/core/irv2/value.rb', line 11

def initialize(id, op, args, attrs, stamp: nil, elem_stamps: nil)
  @id = id
  @op = op
  @args = args
  @attrs = attrs
  @stamp = stamp
  @elem_stamps = elem_stamps
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



9
10
11
# File 'lib/kumi/core/irv2/value.rb', line 9

def args
  @args
end

#attrsObject (readonly)

Returns the value of attribute attrs.



9
10
11
# File 'lib/kumi/core/irv2/value.rb', line 9

def attrs
  @attrs
end

#elem_stampsObject (readonly)

Returns the value of attribute elem_stamps.



9
10
11
# File 'lib/kumi/core/irv2/value.rb', line 9

def elem_stamps
  @elem_stamps
end

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/kumi/core/irv2/value.rb', line 9

def id
  @id
end

#opObject (readonly)

Returns the value of attribute op.



9
10
11
# File 'lib/kumi/core/irv2/value.rb', line 9

def op
  @op
end

#stampObject (readonly)

Returns the value of attribute stamp.



9
10
11
# File 'lib/kumi/core/irv2/value.rb', line 9

def stamp
  @stamp
end

Instance Method Details

#to_sObject



20
21
22
23
24
# File 'lib/kumi/core/irv2/value.rb', line 20

def to_s
  a = args.map { |x| x.is_a?(Value) ? "%#{x.id}" : x.inspect }.join(", ")
  attrs_s = attrs.empty? ? "" : " " + attrs.map { |k, v| "#{k}: #{v.inspect}" }.join(", ")
  format("%%%d = %s(%s)%s", id, op, a, attrs_s)
end