Sha256: fe4b80ae63dc22995bf1f5e01e6920d2b9dfc12969100158af22a4348b185bdc
Contents?: true
Size: 962 Bytes
Versions: 1
Compression:
Stored size: 962 Bytes
Contents
module ByStar module ByWeek # For reasoning why I use *args rather than variables here, # please see the by_year method comments in lib/by_star/by_year.rb def by_week(*args) options = args.extract_options!.symbolize_keys! time = args.first time ||= Time.zone.local(options[:year], 1, 1) if options[:year] time ||= Time.zone.now send("by_week_#{time_klass(time)}", time, options) end private def by_week_Time_or_Date(time, options={}) between(time.beginning_of_week, time.end_of_week, options) end alias_method :by_week_Time, :by_week_Time_or_Date alias_method :by_week_Date, :by_week_Time_or_Date def by_week_Fixnum(week, options={}) time = Time.zone.local(options[:year], 1, 1) if options[:year] time ||= Time.zone.now start_time = time.beginning_of_year + week.to_i.weeks between(start_time, (start_time + 1.week).end_of_day, options) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
by_star-2.0.0.beta1 | lib/by_star/by_week.rb |