Method: React::Component::ClassMethods#add_item_to_tree
- Defined in:
- lib/react/component/class_methods.rb
#add_item_to_tree(current_tree, new_item) ⇒ Object
159 160 161 162 163 164 165 166 167 168 |
# File 'lib/react/component/class_methods.rb', line 159 def add_item_to_tree(current_tree, new_item) if Native(current_tree).class != Native::Object || new_item.length == 1 new_item.inject { |a, e| { e => a } } else Native(current_tree)[new_item.last] = add_item_to_tree( Native(current_tree)[new_item.last], new_item[0..-2] ) current_tree end end |