Sha256: 5e9713d2319344d4f332b9712a0c655cb4392b04cf4beb7804276be2d7a428ee

Contents?: true

Size: 556 Bytes

Versions: 2

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

module Fear
  module Extractor
    # Match and capture identifier with specific type. E.g. +foo : Integer+
    #
    class TypedIdentifierMatcher < Matcher
      # @!attribute identifier
      #   @return [IdentifierMatcher]
      # @!attribute type
      #   @return [ValueMatcher]

      def defined_at?(other)
        type.defined_at?(other)
      end

      def bindings(other)
        { identifier.name => other }
      end

      def failure_reason(other)
        type.failure_reason(other)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fear-1.2.0 lib/fear/extractor/typed_identifier_matcher.rb
fear-1.1.0 lib/fear/extractor/typed_identifier_matcher.rb