Class: WAG::Import
Instance Attribute Summary collapse
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#module_name ⇒ Object
readonly
Returns the value of attribute module_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #func(label, &block) ⇒ Object
- #global(label, type, &block) ⇒ Object
-
#initialize(module_name, name) ⇒ Import
constructor
A new instance of Import.
- #memory(number, min = nil, max = nil, &block) ⇒ Object
- #table(number, type = :funcref, &block) ⇒ Object
- #to_sexpr ⇒ Object
Methods included from Encodable
Constructor Details
#initialize(module_name, name) ⇒ Import
Returns a new instance of Import.
9 10 11 12 |
# File 'lib/wag/import.rb', line 9 def initialize(module_name, name) @module_name = module_name @name = name end |
Instance Attribute Details
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
7 8 9 |
# File 'lib/wag/import.rb', line 7 def desc @desc end |
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
7 8 9 |
# File 'lib/wag/import.rb', line 7 def module_name @module_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/wag/import.rb', line 7 def name @name end |
Instance Method Details
#func(label, &block) ⇒ Object
14 15 16 17 18 |
# File 'lib/wag/import.rb', line 14 def func(label, &block) @desc = Function.new(label) @desc.instance_exec(&block) if block @desc end |
#global(label, type, &block) ⇒ Object
20 21 22 23 24 |
# File 'lib/wag/import.rb', line 20 def global(label, type, &block) @desc = Global.new(label, type) @desc.instance_exec(&block) if block @desc end |
#memory(number, min = nil, max = nil, &block) ⇒ Object
26 27 28 29 30 |
# File 'lib/wag/import.rb', line 26 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
32 33 34 35 36 |
# File 'lib/wag/import.rb', line 32 def table(number, type = :funcref, &block) @desc = Table.new(number, type) @desc.instance_exec(&block) if block @desc end |
#to_sexpr ⇒ Object
38 39 40 |
# File 'lib/wag/import.rb', line 38 def to_sexpr [:import, module_name, name, desc.to_sexpr] end |