Class: Eventually::Callable
- Inherits:
-
Object
- Object
- Eventually::Callable
- Extended by:
- Forwardable
- Defined in:
- lib/eventually/callable.rb
Instance Attribute Summary collapse
-
#availability ⇒ Object
Returns the value of attribute availability.
-
#callable ⇒ Object
readonly
Returns the value of attribute callable.
Instance Method Summary collapse
- #continuous? ⇒ Boolean
-
#initialize(callable, block, availability = :continuous) ⇒ Callable
constructor
A new instance of Callable.
- #pick_callable(c, b) ⇒ Object
Constructor Details
#initialize(callable, block, availability = :continuous) ⇒ Callable
Returns a new instance of Callable.
12 13 14 15 |
# File 'lib/eventually/callable.rb', line 12 def initialize(callable, block, availability=:continuous) @callable = pick_callable(callable, block) @availability = availability end |
Instance Attribute Details
#availability ⇒ Object
Returns the value of attribute availability.
8 9 10 |
# File 'lib/eventually/callable.rb', line 8 def availability @availability end |
#callable ⇒ Object (readonly)
Returns the value of attribute callable.
7 8 9 |
# File 'lib/eventually/callable.rb', line 7 def callable @callable end |
Instance Method Details
#continuous? ⇒ Boolean
28 29 30 |
# File 'lib/eventually/callable.rb', line 28 def continuous? @availability == :continuous end |
#pick_callable(c, b) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/eventually/callable.rb', line 17 def pick_callable(c, b) cb = nil if c.respond_to?(:call) cb = c elsif !b.nil? cb = b else raise 'Cannot register callable. Neither callable nor block was given.' end end |