Class: WAG::Data

Inherits:
Object
  • Object
show all
Includes:
Encodable
Defined in:
lib/wag/data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Encodable

#to_wasm, #to_wat

Constructor Details

#initialize(offset, value) ⇒ Data

Returns a new instance of Data.



9
10
11
12
# File 'lib/wag/data.rb', line 9

def initialize(offset, value)
  @offset = offset.to_i
  @value = value
end

Instance Attribute Details

#offsetObject (readonly)

Returns the value of attribute offset.



7
8
9
# File 'lib/wag/data.rb', line 7

def offset
  @offset
end

#valueObject (readonly)

Returns the value of attribute value.



7
8
9
# File 'lib/wag/data.rb', line 7

def value
  @value
end

Instance Method Details

#to_sexprObject



14
15
16
# File 'lib/wag/data.rb', line 14

def to_sexpr
  [:data, [:'i32.const', offset], value]
end