Class: Rlang::Parser::Export
Constant Summary collapse
- @@exports =
[]
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Class Method Summary collapse
- .reset! ⇒ Object
-
.transpile(depth) ⇒ Object
Export Rlang funcs, etc…
Instance Method Summary collapse
-
#initialize(object) ⇒ Export
constructor
Object can be either a method object or a global object.
Constructor Details
#initialize(object) ⇒ Export
Object can be either a method object or a global object
9 10 11 12 |
# File 'lib/rlang/parser/export.rb', line 9 def initialize(object) @object = object @@exports << self end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
6 7 8 |
# File 'lib/rlang/parser/export.rb', line 6 def object @object end |
Class Method Details
.reset! ⇒ Object
14 15 16 |
# File 'lib/rlang/parser/export.rb', line 14 def self.reset! @@exports = [] end |
.transpile(depth) ⇒ Object
Export Rlang funcs, etc… grouping them by object type for Wasm code readability
20 21 22 23 24 25 |
# File 'lib/rlang/parser/export.rb', line 20 def self.transpile(depth) indent = ' ' * depth * 2 indent + @@exports.sort_by {|e| e.object.class.to_s}.collect do |export| export.object.export_wasm_code end.join("\n#{indent}") end |