Class: Quincunx::CaseList
- Inherits:
-
Object
- Object
- Quincunx::CaseList
- Defined in:
- lib/quincunx/case_list.rb
Instance Method Summary collapse
Instance Method Details
#<<(method) ⇒ Object
4 5 6 |
# File 'lib/quincunx/case_list.rb', line 4 def << method cases << method ; self end |
#match(obj, args) ⇒ Object
8 9 10 |
# File 'lib/quincunx/case_list.rb', line 8 def match(obj, args) Option[cases.map { |method| method.application(obj, args) }.find(&:matches?)] end |