Class: UnderOs::UI::Collection::Item
- Inherits:
-
View
- Object
- View
- UnderOs::UI::Collection::Item
- Defined in:
- lib/under_os/ui/collection/item.rb
Overview
This is the collection item class that you supposed to inherit (well, if you need to)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build(collection, &builder) ⇒ Object
9 10 11 12 13 |
# File 'lib/under_os/ui/collection/item.rb', line 9 def self.build(collection, &builder) @builders ||= {} @builders[collection] = builder collection.item_class = self end |
.for(collection, stylesheet = nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/under_os/ui/collection/item.rb', line 15 def self.for(collection, stylesheet=nil) new.tap do |view| def view.parent; @_parent; end view.instance_variable_set('@_parent', collection) @builders[collection] && @builders[collection].call.each do |child| view.insert child end view.repaint(stylesheet || UnderOs::App.history.current_page.stylesheet) end end |
Instance Method Details
#cleanup ⇒ Object
28 29 30 |
# File 'lib/under_os/ui/collection/item.rb', line 28 def cleanup # implement me if you need to clean cells between reuse end |