Module: Mongoid::ByStar::ClassMethods
- Includes:
- ByStar::Base
- Defined in:
- lib/by_star/orm/mongoid/by_star.rb
Instance Method Summary
collapse
#by_star_end_field, #by_star_field, #by_star_offset, #by_star_scope, #by_star_start_field
#after, #before
#between_times, #by_calendar_month, #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
#between_times_query(start, finish, options = {}) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/by_star/orm/mongoid/by_star.rb', line 12
def between_times_query(start, finish, options={})
start_field = by_star_start_field(options)
end_field = by_star_end_field(options)
scope = by_star_scope(options)
scope = if options[:strict] || start_field == end_field
scope.gte(start_field => start).lte(end_field => finish)
else
scope.gt(end_field => start).lt(start_field => finish)
end
scope = scope.order_by(field => options[:order]) if options[:order]
scope
end
|
#by_star_end_field_with_mongoid(options = {}) ⇒ Object
26
27
28
|
# File 'lib/by_star/orm/mongoid/by_star.rb', line 26
def by_star_end_field_with_mongoid(options = {})
database_field_name by_star_end_field_without_mongoid(options)
end
|
#by_star_start_field_with_mongoid(options = {}) ⇒ Object
31
32
33
|
# File 'lib/by_star/orm/mongoid/by_star.rb', line 31
def by_star_start_field_with_mongoid(options = {})
database_field_name by_star_start_field_without_mongoid(options)
end
|