class PageMagic::Comparator::Fuzzy
class Fuzzy
- used for modeling and comparing components that are ‘fuzzy’ i.e. respond to ‘=~` e.g. a Regexp
Public Class Methods
new(comparator)
click to toggle source
Calls superclass method
PageMagic::Comparator::new
# File lib/page_magic/comparator/fuzzy.rb, line 7 def initialize(comparator) super(comparator, true) end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/page_magic/comparator/fuzzy.rb, line 15 def <=>(other) return -1 if other.is_a?(Null) return 1 unless other.fuzzy? 0 end
match?(value)
click to toggle source
# File lib/page_magic/comparator/fuzzy.rb, line 11 def match?(value) comparator =~ value ? true : false end