Module: Tins::CasePredicate
- Included in:
- Object
- Defined in:
- lib/tins/case_predicate.rb
Overview
A module that provides a predicate method for checking if a value matches any of the given cases.
Instance Method Summary collapse
-
#case?(*args) ⇒ Object?
Checks if the object matches any of the given arguments using the === operator.
Instance Method Details
#case?(*args) ⇒ Object?
Checks if the object matches any of the given arguments using the === operator.
This method provides pattern matching functionality similar to Ruby’s case/when statements, using the === operator for semantic equality checking.
found
24 25 26 |
# File 'lib/tins/case_predicate.rb', line 24 def case?(*args) args.find { |a| a === self } end |