Sha256: f05a2ed056dcafde1cf8197feb1a1e2c444fc966ecdc5d68a19cbd0f4eb74f32

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

module ByStar
  module ByDay
    def by_day(*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_day_#{time_klass(time)}", time, options)
    end

    def today(options={})
      by_day_Time(Time.zone.now, options)
    end

    def yesterday(options={})
      by_day_Time(Time.zone.now.yesterday, options)
    end

    def tomorrow(options={})
      by_day_Time(Time.zone.now.tomorrow, options)
    end

    private

    def by_day_Time(time, options)
      between(time.beginning_of_day, time.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_day.rb