Class: PageMagic::Comparator::Literal
- Inherits:
-
PageMagic::Comparator
- Object
- PageMagic::Comparator
- PageMagic::Comparator::Literal
- Defined in:
- lib/page_magic/comparator/literal.rb
Overview
class Literal - used for modeling and comparing thing directly. E.g. strings
Instance Attribute Summary
Attributes inherited from PageMagic::Comparator
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(comparator) ⇒ Literal
constructor
A new instance of Literal.
- #match?(value) ⇒ Boolean
Methods inherited from PageMagic::Comparator
Constructor Details
#initialize(comparator) ⇒ Literal
Returns a new instance of Literal.
7 8 9 |
# File 'lib/page_magic/comparator/literal.rb', line 7 def initialize(comparator) super(comparator, false) end |
Instance Method Details
#<=>(other) ⇒ Object
15 16 17 18 19 |
# File 'lib/page_magic/comparator/literal.rb', line 15 def <=>(other) return 1 if other.fuzzy? || other.is_a?(Null) 0 end |
#match?(value) ⇒ Boolean
11 12 13 |
# File 'lib/page_magic/comparator/literal.rb', line 11 def match?(value) comparator == value end |