Module: GeoPattern::Roles::ComparableMetadata::ClassMethods

Defined in:
lib/geo_pattern/roles/comparable_metadata.rb

Overview

Class Methods

Instance Method Summary collapse

Instance Method Details

#def_comparators(*methods) ⇒ Object

Define comparators


22
23
24
25
26
27
28
29
30
31
# File 'lib/geo_pattern/roles/comparable_metadata.rb', line 22

def def_comparators(*methods)
  methods.flatten.each do |m|
    define_method "#{m}?".to_sym do |value|
      return true if value.nil? && public_send(m)
      return true if value == public_send(m)

      false
    end
  end
end