Module: Timeframeable::Controller::ClassMethods
- Defined in:
- lib/timeframeable/controller.rb
Instance Method Summary collapse
Instance Method Details
#timeframeable(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/timeframeable/controller.rb', line 6 def timeframeable(={}) = .dup [:start_key] ||= :start [:end_key] ||= :end [:variable] ||= :timeframe [:defaults] ||= [] [:defaults] = [:defaults].map do |x| if x.is_a? Symbol if x == :now DateTime.now.utc else DateTime.now.send(x).utc end else x && x.to_datetime.utc end end before_filter do set_timeframe end end |