Class: DateSupercharger::Matcher
- Inherits:
-
Object
- Object
- DateSupercharger::Matcher
- Defined in:
- lib/date_supercharger/matcher.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#suffix ⇒ Object
Returns the value of attribute suffix.
Instance Method Summary collapse
-
#initialize(model, method_sym) ⇒ Matcher
constructor
A new instance of Matcher.
- #match? ⇒ Boolean
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
#attribute ⇒ Object
Returns the value of attribute attribute.
4 5 6 |
# File 'lib/date_supercharger/matcher.rb', line 4 def attribute @attribute end |
#suffix ⇒ Object
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
18 19 20 |
# File 'lib/date_supercharger/matcher.rb', line 18 def match? @attribute != nil end |