Module: ByStar::Base

Includes:
Between, Directional
Included in:
ActiveRecord::ClassMethods, Mongoid::ByStar::ClassMethods
Defined in:
lib/by_star/base.rb

Instance Method Summary collapse

Methods included from Directional

#after, #before, #newest, #oldest

Methods included from Between

#at_time, #between_dates, #between_times, #by_calendar_month, #by_cweek, #by_day, #by_fortnight, #by_month, #by_quarter, #by_week, #by_weekend, #by_year, #next_day, #next_fortnight, #next_month, #next_week, #next_year, #past_day, #past_fortnight, #past_month, #past_week, #past_year, #today, #tomorrow, #yesterday

Instance Method Details

#by_star_end_field(options = {}) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/by_star/base.rb', line 29

def by_star_end_field(options={})
  field = options[:field] ||
      options[:end_field] ||
      @by_star_end_field ||
      by_star_start_field
  field.to_s
end

#by_star_field(*args) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/by_star/base.rb', line 8

def by_star_field(*args)
  options = args.extract_options!
  @by_star_start_field ||= args[0]
  @by_star_end_field   ||= args[1]
  @by_star_offset      ||= options[:offset]
  @by_star_scope       ||= options[:scope]
  @by_star_index_scope ||= options[:index_scope]
end

#by_star_offset(options = {}) ⇒ Object



17
18
19
# File 'lib/by_star/base.rb', line 17

def by_star_offset(options = {})
  (options[:offset] || @by_star_offset || 0).seconds
end

#by_star_start_field(options = {}) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/by_star/base.rb', line 21

def by_star_start_field(options={})
  field = options[:field] ||
      options[:start_field] ||
      @by_star_start_field ||
      by_star_default_field
  field.to_s
end