Class: FFI::Generator::Node
- Inherits:
-
Object
- Object
- FFI::Generator::Node
- Defined in:
- lib/generator/node.rb
Instance Attribute Summary collapse
-
#symname ⇒ Object
readonly
Returns the value of attribute symname.
Instance Method Summary collapse
- #get_attr(name) ⇒ Object
-
#initialize(params = { }) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(params = { }) ⇒ Node
Returns a new instance of Node.
5 6 7 8 9 10 |
# File 'lib/generator/node.rb', line 5 def initialize(params = { }) params = { :indent => 0 }.merge(params) @node, @indent = params[:node], params[:indent] @indent_str = ' ' * @indent @symname = get_attr('name') end |
Instance Attribute Details
#symname ⇒ Object (readonly)
Returns the value of attribute symname.
4 5 6 |
# File 'lib/generator/node.rb', line 4 def symname @symname end |
Instance Method Details
#get_attr(name) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/generator/node.rb', line 11 def get_attr(name) if @node attr = (@node / "./attributelist/attribute[@name='#{name}']").first attr['value'] if attr end end |