Class: Reline::KeyActor::Composite

Inherits:
Object
  • Object
show all
Defined in:
lib/reline/key_actor/composite.rb

Instance Method Summary collapse

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

Returns:

  • (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