Sha256: 591f7605b89a8bb62bc891b2d4b72855a519d9b1575d869992d5297960f4f615
Contents?: true
Size: 656 Bytes
Versions: 1
Compression:
Stored size: 656 Bytes
Contents
module DateSupercharger class Matcher attr_accessor :attribute,:suffix 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 def match? @attribute != nil end private def get_date_columns(model) model.columns_hash.keys.select do |c| [:datetime,:date].include? model.columns_hash[c].type end.map(&:to_sym) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
date_supercharger-0.1.1 | lib/date_supercharger/matcher.rb |