Class: WAG::Export
Instance Attribute Summary collapse
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #func(label, &block) ⇒ Object
- #global(label, type) ⇒ Object
-
#initialize(name) ⇒ Export
constructor
A new instance of Export.
- #memory(number, min = nil, max = nil, &block) ⇒ Object
- #table(number, type = :funcref, &block) ⇒ Object
- #to_sexpr ⇒ Object
Methods included from Encodable
Constructor Details
#initialize(name) ⇒ Export
Returns a new instance of Export.
9 10 11 |
# File 'lib/wag/export.rb', line 9 def initialize(name) @name = name end |
Instance Attribute Details
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
7 8 9 |
# File 'lib/wag/export.rb', line 7 def desc @desc end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/wag/export.rb', line 7 def name @name end |
Instance Method Details
#func(label, &block) ⇒ Object
13 14 15 16 17 |
# File 'lib/wag/export.rb', line 13 def func(label, &block) @desc = Function.new(label) @desc.instance_exec(&block) if block @desc end |
#global(label, type) ⇒ Object
19 20 21 |
# File 'lib/wag/export.rb', line 19 def global(label, type) @desc = Global.new(label, type) end |
#memory(number, min = nil, max = nil, &block) ⇒ Object
23 24 25 26 27 |
# File 'lib/wag/export.rb', line 23 def memory(number, min = nil, max = nil, &block) @desc = Memory.new(number, min, max) @desc.instance_exec(&block) if block @desc end |
#table(number, type = :funcref, &block) ⇒ Object
29 30 31 32 33 |
# File 'lib/wag/export.rb', line 29 def table(number, type = :funcref, &block) @desc = Table.new(number, type) @desc.instance_exec(&block) if block @desc end |
#to_sexpr ⇒ Object
35 36 37 |
# File 'lib/wag/export.rb', line 35 def to_sexpr [:export, name, desc.to_sexpr] end |