Class: Schedular::Time

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/schedular/time.rb

Class Method Summary collapse

Class Method Details

.by_params(params) ⇒ Object



37
38
39
40
41
# File 'lib/schedular/time.rb', line 37

def self.by_params params
  return if params[:year].nil? and params[:month].nil? #TODO: By year
  day = Date.civil params[:year].to_i, params[:month].to_i, (params[:day] || 1).to_i
  params[:day] ? by_time_or_period(day) : by_time_or_period(day..day >> 1)
end