Class: ZOMG::IDL::Nodes::Node
- Inherits:
-
Object
- Object
- ZOMG::IDL::Nodes::Node
- Defined in:
- lib/zomg/idl/nodes/node.rb
Direct Known Subclasses
Attribute, Binary, Constant, Interface, InterfaceHeader, Member, Operation, Parameter, Typedef, Union
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #duhr ⇒ Object
-
#initialize(children = [], options = {}) ⇒ Node
constructor
A new instance of Node.
- #to_i ⇒ Object
- #to_ruby(prefix = nil) ⇒ Object
- #to_ruby_sexp ⇒ Object
- #to_sexp ⇒ Object
Methods included from Visitable
Constructor Details
#initialize(children = [], options = {}) ⇒ Node
Returns a new instance of Node.
9 10 11 12 |
# File 'lib/zomg/idl/nodes/node.rb', line 9 def initialize(children = [], = {}) @children = children .each { |k,v| send(:"#{k}=", v) } end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
8 9 10 |
# File 'lib/zomg/idl/nodes/node.rb', line 8 def children @children end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/zomg/idl/nodes/node.rb', line 8 def name @name end |
Instance Method Details
#to_i ⇒ Object
14 15 16 |
# File 'lib/zomg/idl/nodes/node.rb', line 14 def to_i children.to_i end |
#to_ruby(prefix = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/zomg/idl/nodes/node.rb', line 30 def to_ruby(prefix = nil) r2r = Ruby2Ruby.new ruby_code = r2r.process(to_ruby_sexp) if prefix modules = prefix.split(/::/).map { |m| "module #{m}\n" } ends = modules.map { |m| "end" }.join("\n") "#{modules}#{ruby_code}\n#{ends}" else ruby_code end end |