Class: DateSupercharger::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/date_supercharger/matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, method_sym) ⇒ Matcher

Returns a new instance of Matcher.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/date_supercharger/matcher.rb', line 6

def initialize(model,method_sym)
  if method_sym.to_s =~ /^(.+)_(before|after|before_or_at|after_or_at|between|between_inclusive)$/
    date_columns = get_date_columns(model)

    if date_columns.include? $1.to_sym
      @attribute = $1.to_sym
      @suffix = $2.to_sym
    end
  end

end

Instance Attribute Details

#attributeObject

Returns the value of attribute attribute.



4
5
6
# File 'lib/date_supercharger/matcher.rb', line 4

def attribute
  @attribute
end

#suffixObject

Returns the value of attribute suffix.



4
5
6
# File 'lib/date_supercharger/matcher.rb', line 4

def suffix
  @suffix
end

Instance Method Details

#match?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/date_supercharger/matcher.rb', line 18

def match?
  @attribute != nil
end