Class: Results::Filter
- Inherits:
-
Object
- Object
- Results::Filter
- Defined in:
- lib/results.rb
Instance Method Summary collapse
- #call(value) ⇒ Object
-
#initialize(msg_or_proc, &filter_block) ⇒ Filter
constructor
A new instance of Filter.
- #message ⇒ Object
Constructor Details
#initialize(msg_or_proc, &filter_block) ⇒ Filter
Returns a new instance of Filter.
70 71 72 73 74 |
# File 'lib/results.rb', line 70 def initialize(msg_or_proc, &filter_block) raise ArgumentError, 'invalid message' if msg_or_proc.nil? raise ArgumentError, 'no block given' if filter_block.nil? @msg_or_proc, @filter_block = msg_or_proc, filter_block end |
Instance Method Details
#call(value) ⇒ Object
76 77 78 |
# File 'lib/results.rb', line 76 def call(value) @filter_block.call(value) end |
#message ⇒ Object
80 81 82 |
# File 'lib/results.rb', line 80 def @msg_or_proc end |