Class: ClearLogic::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/clear_logic/matcher.rb

Constant Summary collapse

CASES =
%i[success failure].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(*args) ⇒ Object



7
8
9
# File 'lib/clear_logic/matcher.rb', line 7

def self.call(*args)
  new.matcher.call(*args) { |on| yield(on) }
end

Instance Method Details

#matcherObject



11
12
13
14
15
16
17
# File 'lib/clear_logic/matcher.rb', line 11

def matcher
  dry_cases = CASES.each_with_object({}) do |one_case, case_list|
    case_list[one_case] = send("#{one_case}_case")
  end

  Dry::Matcher.new(dry_cases)
end