Sha256: c020bb0f9853181924d6e32036f69a75cea943203d674764fa07f3f58c498997

Contents?: true

Size: 435 Bytes

Versions: 12

Compression:

Stored size: 435 Bytes

Contents

# frozen_string_literal: true

module PageMagic
  class Comparator
    # class Literal - used for modeling and comparing thing directly. E.g. strings
    class Literal < Comparator
      def initialize(comparator)
        super(comparator, false)
      end

      def match?(value)
        comparator == value
      end

      def <=>(other)
        return 1 if other.fuzzy? || other.is_a?(Null)

        0
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
page_magic-2.0.13 lib/page_magic/comparator/literal.rb
page_magic-2.0.12 lib/page_magic/comparator/literal.rb
page_magic-2.0.11 lib/page_magic/comparator/literal.rb
page_magic-2.0.10 lib/page_magic/comparator/literal.rb
page_magic-2.0.9 lib/page_magic/comparator/literal.rb
page_magic-2.0.6 lib/page_magic/comparator/literal.rb
page_magic-2.0.5 lib/page_magic/comparator/literal.rb
page_magic-2.0.4 lib/page_magic/comparator/literal.rb
page_magic-2.0.3 lib/page_magic/comparator/literal.rb
page_magic-2.0.2 lib/page_magic/comparator/literal.rb
page_magic-2.0.1 lib/page_magic/comparator/literal.rb
page_magic-2.0.0 lib/page_magic/comparator/literal.rb