Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleanup extra methods

  • Loading branch information...
commit b326542a080d1117416862737c1a8afb28c7fc63 1 parent 9f34ba4
@johnnyshields johnnyshields authored
View
10 lib/by_star/by_calendar_month.rb
@@ -4,15 +4,9 @@ module ByCalendarMonth
def by_calendar_month(*args)
with_by_star_options(*args) do |time, options|
time = ByStar::Normalization.month(time, options)
- by_calendar_month_query(time, options)
+ start_day = Array(options[:start_day])
+ between(time.beginning_of_calendar_month(*start_day), time.end_of_calendar_month(*start_day), options)
end
end
-
- private
-
- def by_calendar_month_query(time, options={})
- start_day = Array(options[:start_day])
- between(time.beginning_of_calendar_month(*start_day), time.end_of_calendar_month(*start_day), options)
- end
end
end
View
14 lib/by_star/by_day.rb
@@ -4,26 +4,20 @@ module ByDay
def by_day(*args)
with_by_star_options(*args) do |time, options|
time = ByStar::Normalization.time(time)
- by_day_query(time, options)
+ between(time.beginning_of_day, time.end_of_day, options)
end
end
def today(options={})
- by_day_query(Time.zone.now, options)
+ by_day(Time.zone.now, options)
end
def yesterday(options={})
- by_day_query(Time.zone.now.yesterday, options)
+ by_day(Time.zone.now.yesterday, options)
end
def tomorrow(options={})
- by_day_query(Time.zone.now.tomorrow, options)
- end
-
- protected
-
- def by_day_query(time, options)
- between(time.beginning_of_day, time.end_of_day, options)
+ by_day(Time.zone.now.tomorrow, options)
end
end
end
View
8 lib/by_star/by_fortnight.rb
@@ -4,14 +4,8 @@ module ByFortnight
def by_fortnight(*args)
with_by_star_options(*args) do |time, options|
time = ByStar::Normalization.fortnight(time, options)
- by_fortnight_query(time, options)
+ between(time.beginning_of_fortnight, time.end_of_fortnight, options)
end
end
-
- private
-
- def by_fortnight_query(time, options={})
- between(time.beginning_of_fortnight, time.end_of_fortnight, options)
- end
end
end
View
8 lib/by_star/by_month.rb
@@ -4,14 +4,8 @@ module ByMonth
def by_month(*args)
with_by_star_options(*args) do |time, options|
time = ByStar::Normalization.month(time, options)
- by_month_query(time, options)
+ between(time.beginning_of_month, time.end_of_month, options)
end
end
-
- private
-
- def by_month_query(time, options={})
- between(time.beginning_of_month, time.end_of_month, options)
- end
end
end
View
8 lib/by_star/by_quarter.rb
@@ -4,14 +4,8 @@ module ByQuarter
def by_quarter(*args)
with_by_star_options(*args) do |time, options|
time = ByStar::Normalization.quarter(time, options)
- by_quarter_query(time, options)
+ between(time.beginning_of_quarter, time.end_of_quarter, options)
end
end
-
- private
-
- def by_quarter_query(time, options={})
- between(time.beginning_of_quarter, time.end_of_quarter, options)
- end
end
end
View
10 lib/by_star/by_week.rb
@@ -4,15 +4,9 @@ module ByWeek
def by_week(*args)
with_by_star_options(*args) do |time, options|
time = ByStar::Normalization.week(time, options)
- by_week_query(time, options)
+ start_day = Array(options[:start_day])
+ between(time.beginning_of_week(*start_day), time.end_of_week(*start_day), options)
end
end
-
- private
-
- def by_week_query(time, options={})
- start_day = Array(options[:start_day])
- between(time.beginning_of_week(*start_day), time.end_of_week(*start_day), options)
- end
end
end
View
8 lib/by_star/by_weekend.rb
@@ -4,14 +4,8 @@ module ByWeekend
def by_weekend(*args)
with_by_star_options(*args) do |time, options|
time = ByStar::Normalization.week(time, options)
- by_weekend_query(time, options)
+ between(time.beginning_of_weekend, time.end_of_weekend, options)
end
end
-
- private
-
- def by_weekend_query(time, options={})
- between(time.beginning_of_weekend, time.end_of_weekend)
- end
end
end
View
6 lib/by_star/by_year.rb
@@ -4,12 +4,8 @@ module ByYear
def by_year(*args)
with_by_star_options(*args) do |time, options|
time = ByStar::Normalization.year(time, options)
- by_year_query(time, options)
+ between(time.beginning_of_year, time.end_of_year, options)
end
end
-
- def by_year_query(time, options={})
- between(time.beginning_of_year, time.end_of_year, options)
- end
end
end

0 comments on commit b326542

Please sign in to comment.
Something went wrong with that request. Please try again.