Class: TkWrapper::Widgets::Base::WidgetStore
- Inherits:
-
Object
- Object
- TkWrapper::Widgets::Base::WidgetStore
- Extended by:
- Forwardable
- Defined in:
- lib/widgets/base/widget_store.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ WidgetStore
constructor
A new instance of WidgetStore.
- #push(widget) ⇒ Object
Constructor Details
Instance Method Details
#[](key) ⇒ Object
29 30 31 |
# File 'lib/widgets/base/widget_store.rb', line 29 def [](key) @lookup[key]&.size == 1 ? @lookup[key].first : @lookup[key] end |
#each(&block) ⇒ Object
23 24 25 26 27 |
# File 'lib/widgets/base/widget_store.rb', line 23 def each(&block) @lookup.each_value do || .each { || block.call() } end end |
#push(widget) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/widgets/base/widget_store.rb', line 16 def push() .ids.each do |id| (@lookup[id] ||= []).push() end (@lookup[nil] ||= []).push() if .ids.empty? end |