Class: DetailPanelHashController
- Inherits:
-
Shirka::Qt::TreeController
- Object
- Shirka::Controller
- Shirka::Qt::TreeController
- DetailPanelHashController
- Defined in:
- lib/troshka/detail_panel_hash/controller.rb
Instance Attribute Summary
Attributes inherited from Shirka::Controller
#app, #components, #data, #parent, #view
Instance Method Summary collapse
Methods inherited from Shirka::Qt::TreeController
#add_item, #item_controller_class, #on_component_added, #on_double_clicked, #view_class
Methods inherited from Shirka::Controller
#add_component, #add_item, #initialize, #item_controller_class, #on_component_added, #on_component_adding, #view_class
Methods included from Shirka::Eventalk
#add_watcher, #fire, #forward, #watch, #watchers
Constructor Details
This class inherits a constructor from Shirka::Controller
Instance Method Details
#init(data) ⇒ Object
2 3 4 5 |
# File 'lib/troshka/detail_panel_hash/controller.rb', line 2 def init(data) @item_ids = {} data.each {|k, v| add_item [k, v], item_class(v)} end |
#item_class(obj) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/troshka/detail_panel_hash/controller.rb', line 7 def item_class(obj) name = obj.class.ancestors .map {|i| "DetailPanelItem#{i}Controller"} .find {|i| Object.const_get i rescue false} Object.const_get(name) end |