Class: Reline::KeyActor::Composite
- Inherits:
-
Object
- Object
- Reline::KeyActor::Composite
- Defined in:
- lib/reline/key_actor/composite.rb
Instance Method Summary collapse
- #get(key) ⇒ Object
-
#initialize(key_actors) ⇒ Composite
constructor
A new instance of Composite.
- #matching?(key) ⇒ Boolean
Constructor Details
#initialize(key_actors) ⇒ Composite
Returns a new instance of Composite.
2 3 4 |
# File 'lib/reline/key_actor/composite.rb', line 2 def initialize(key_actors) @key_actors = key_actors end |
Instance Method Details
#get(key) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/reline/key_actor/composite.rb', line 10 def get(key) @key_actors.each do |key_actor| func = key_actor.get(key) return func if func end nil end |
#matching?(key) ⇒ Boolean
6 7 8 |
# File 'lib/reline/key_actor/composite.rb', line 6 def matching?(key) @key_actors.any? { |key_actor| key_actor.matching?(key) } end |