Module: Cuprum::Rails::Responders::Matching::ClassMethods
- Defined in:
- lib/cuprum/rails/responders/matching.rb
Overview
Provides a DSL for generating response clauses for matching results.
Instance Method Summary collapse
-
#match(status, error: nil, value: nil) { ... } ⇒ Object
Creates a match clause that maps a result to a response.
- #matchers(**_keywords) ⇒ Object
Instance Method Details
#match(status, error: nil, value: nil) { ... } ⇒ Object
Creates a match clause that maps a result to a response.
27 28 29 30 31 32 33 34 35 |
# File 'lib/cuprum/rails/responders/matching.rb', line 27 def match(status, error: nil, value: nil, &block) matcher = @matcher || Cuprum::Matcher.new matcher.singleton_class.match( status, error: error, value: value, &block ) @matcher = matcher end |
#matchers(**_keywords) ⇒ Object
38 39 40 41 42 |
# File 'lib/cuprum/rails/responders/matching.rb', line 38 def matchers(**_keywords) return [] unless @matcher [@matcher] end |