lib/fear/extractor/extractor_matcher.rb in fear-1.0.0 vs lib/fear/extractor/extractor_matcher.rb in fear-1.1.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Fear module Extractor # Match and extract pattern using registered extractor objects # E.g. +Some(a : Integer)+ # @see Extractor.register_extractor @@ -17,22 +19,22 @@ attr_reader :extractor private :extractor def defined_at?(other) extractor - .call(other) + .(other) .map { |v| arguments_matcher.defined_at?(v) } .get_or_else(false) end def call_or_else(arg) - extractor.call(arg) + extractor.(arg) .map { |v| arguments_matcher.call_or_else(v) { yield arg } } .get_or_else { yield arg } end def failure_reason(other) - extractor.call(other).match do |m| + extractor.(other).match do |m| m.some(->(v) { arguments_matcher.defined_at?(v) }) { Fear.none } m.some { |v| arguments_matcher.failure_reason(v) } m.none { super } end end