Class: Flounder::Result::Accessor::Node
- Inherits:
-
Object
- Object
- Flounder::Result::Accessor::Node
- Defined in:
- lib/flounder/result/accessor/node.rb
Instance Attribute Summary collapse
-
#children_by_name ⇒ Object
readonly
Returns the value of attribute children_by_name.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #add_field(name, *a) ⇒ Object
- #has_obj?(name) ⇒ Boolean
-
#initialize ⇒ Node
constructor
A new instance of Node.
- #names ⇒ Object
- #produce_value(*_) {|_self| ... } ⇒ Object
- #size ⇒ Object
Constructor Details
Instance Attribute Details
#children_by_name ⇒ Object (readonly)
Returns the value of attribute children_by_name.
6 7 8 |
# File 'lib/flounder/result/accessor/node.rb', line 6 def children_by_name @children_by_name end |
Instance Method Details
#[](name) ⇒ Object
14 15 16 |
# File 'lib/flounder/result/accessor/node.rb', line 14 def [] name children_by_name[name.to_sym] end |
#add_field(name, *a) ⇒ Object
24 25 26 |
# File 'lib/flounder/result/accessor/node.rb', line 24 def add_field name, *a children_by_name[name.to_sym] = Field.new(*a) end |
#has_obj?(name) ⇒ Boolean
17 18 19 |
# File 'lib/flounder/result/accessor/node.rb', line 17 def has_obj? name children_by_name.has_key? name.to_sym end |
#names ⇒ Object
20 21 22 |
# File 'lib/flounder/result/accessor/node.rb', line 20 def names children_by_name.keys end |
#produce_value(*_) {|_self| ... } ⇒ Object
32 33 34 |
# File 'lib/flounder/result/accessor/node.rb', line 32 def produce_value *_ yield self end |
#size ⇒ Object
28 29 30 |
# File 'lib/flounder/result/accessor/node.rb', line 28 def size children_by_name.size end |