Class: Emit::InputGuard
- Inherits:
-
Object
- Object
- Emit::InputGuard
- Defined in:
- lib/emit/input_guard.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#channel_end ⇒ Object
readonly
Returns the value of attribute channel_end.
Instance Method Summary collapse
-
#initialize(argument, action = ->(msg) {msg}) ⇒ InputGuard
constructor
A new instance of InputGuard.
Constructor Details
#initialize(argument, action = ->(msg) {msg}) ⇒ InputGuard
Returns a new instance of InputGuard.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/emit/input_guard.rb', line 5 def initialize(argument, action=->(msg) {msg}) case argument when InputGuard @channel_end, @action = argument.channel_end, argument.action when ChannelEndRead @channel_end, @action = argument, action when Array fail "Wrong number of arguments" unless argument.size == 2 @channel_end, @action = argument else fail "Unknown input guard type" end fail "InputGuard must have a reading channel end." unless ChannelEndRead === @channel_end fail "InputGuard action cannot be nil" if @action.nil? end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
3 4 5 |
# File 'lib/emit/input_guard.rb', line 3 def action @action end |
#channel_end ⇒ Object (readonly)
Returns the value of attribute channel_end.
3 4 5 |
# File 'lib/emit/input_guard.rb', line 3 def channel_end @channel_end end |