Class: TkWrapper::Util::Tk::Finder
- Inherits:
-
Object
- Object
- TkWrapper::Util::Tk::Finder
- Defined in:
- lib/util/tk/finder.rb
Constant Summary collapse
Instance Method Summary collapse
- #each_widget_match(widgets, matchers, &block) ⇒ Object
- #find_all_widgets(comparators, widgets = @widgets) ⇒ Object
- #find_widget(comparators, widgets = @widgets) ⇒ Object
-
#initialize(widgets: nil) ⇒ Finder
constructor
A new instance of Finder.
Constructor Details
#initialize(widgets: nil) ⇒ Finder
Returns a new instance of Finder.
10 11 12 |
# File 'lib/util/tk/finder.rb', line 10 def initialize(widgets: nil) @widgets = end |
Instance Method Details
#each_widget_match(widgets, matchers, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/util/tk/finder.rb', line 14 def (, matchers, &block) .each do || .ids.each do |id| matchers.each do |matcher| (match = matcher.match(id, )) && block.call(match) end end end end |
#find_all_widgets(comparators, widgets = @widgets) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/util/tk/finder.rb', line 32 def (comparators, = @widgets) matchers = create_value_matchers(comparators) matches = TkWrapper::Widgets::Base::Matches.new (, matchers) do |match| matches.push(match) end matches end |
#find_widget(comparators, widgets = @widgets) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/util/tk/finder.rb', line 24 def (comparators, = @widgets) matchers = create_value_matchers(comparators) (, matchers) do |match| return match. if match end end |