Class: Tap::Signal
- Inherits:
-
Object
- Object
- Tap::Signal
- Defined in:
- lib/tap/signal.rb
Overview
Signal attaches an object and allows a specific method to be triggered through a standard interface.
Direct Known Subclasses
Tap::Signals::Configure, Tap::Signals::Help, Tap::Signals::Load
Class Attribute Summary collapse
-
.desc ⇒ Object
A description of self.
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
An optional block, used at the signal’s discretion (normally passed to the method the signal targets on obj).
-
#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.
- #inspect ⇒ Object
-
#process(args) ⇒ Object
Simply returns the input args.
Constructor Details
#initialize(obj, &block) ⇒ Signal
Returns a new instance of Signal.
19 20 21 22 |
# File 'lib/tap/signal.rb', line 19 def initialize(obj, &block) @obj = obj @block = block end |
Class Attribute Details
.desc ⇒ Object
A description of self
9 10 11 |
# File 'lib/tap/signal.rb', line 9 def desc @desc end |
Instance Attribute Details
#block ⇒ Object (readonly)
An optional block, used at the signal’s discretion (normally passed to the method the signal targets on obj).
17 18 19 |
# File 'lib/tap/signal.rb', line 17 def block @block end |
#obj ⇒ Object (readonly)
The object receiving signals through self.
13 14 15 |
# File 'lib/tap/signal.rb', line 13 def obj @obj end |
Instance Method Details
#call(args) ⇒ Object
Calls process with the input args and returns the result.
25 26 27 |
# File 'lib/tap/signal.rb', line 25 def call(args) process(args) end |
#inspect ⇒ Object
34 35 36 |
# File 'lib/tap/signal.rb', line 34 def inspect "#<#{self.class}:#{object_id}>" end |
#process(args) ⇒ Object
Simply returns the input args.
30 31 32 |
# File 'lib/tap/signal.rb', line 30 def process(args) args end |