Class: Case::Guard
- Inherits:
-
Object
- Object
- Case::Guard
- Defined in:
- lib/case.rb
Instance Method Summary collapse
- #===(obj) ⇒ Object
-
#initialize(&predicate) ⇒ Guard
constructor
A new instance of Guard.
Constructor Details
#initialize(&predicate) ⇒ Guard
Returns a new instance of Guard.
79 80 81 |
# File 'lib/case.rb', line 79 def initialize(&predicate) @predicate = predicate end |
Instance Method Details
#===(obj) ⇒ Object
83 84 85 |
# File 'lib/case.rb', line 83 def ===(obj) @predicate.call obj end |