Class: Tap::Signals::Signal
- Inherits:
-
Object
- Object
- Tap::Signals::Signal
- Defined in:
- lib/tap/signals/signal.rb
Overview
Signal attaches an object and allows a specific method to be triggered through a standard interface.
Direct Known Subclasses
Class Attribute Summary collapse
-
.desc ⇒ Object
A description of self.
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#obj ⇒ Object
readonly
The object receiving signals through self.
Instance Method Summary collapse
-
#call(args) ⇒ Object
Calls process with the input args and returns the result.
-
#initialize(obj, &block) ⇒ Signal
constructor
A new instance of Signal.
-
#process(args) ⇒ Object
Simply returns the input args.
Constructor Details
#initialize(obj, &block) ⇒ Signal
Returns a new instance of Signal.
17 18 19 20 |
# File 'lib/tap/signals/signal.rb', line 17 def initialize(obj, &block) @obj = obj @block = block end |
Class Attribute Details
.desc ⇒ Object
A description of self
9 10 11 |
# File 'lib/tap/signals/signal.rb', line 9 def desc @desc end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
15 16 17 |
# File 'lib/tap/signals/signal.rb', line 15 def block @block end |
#obj ⇒ Object (readonly)
The object receiving signals through self.
13 14 15 |
# File 'lib/tap/signals/signal.rb', line 13 def obj @obj end |
Instance Method Details
#call(args) ⇒ Object
Calls process with the input args and returns the result. This method is a hook for subclasses.
24 25 26 |
# File 'lib/tap/signals/signal.rb', line 24 def call(args) process(args) end |
#process(args) ⇒ Object
Simply returns the input args. This method is a hook for subclasses.
29 30 31 |
# File 'lib/tap/signals/signal.rb', line 29 def process(args) args end |