Rename Time#whole_* to Time#all_* [thanks Pratik!]
This commit is contained in:
parent
d6cc0e56bd
commit
a6467802ff
@ -1,6 +1,6 @@
|
|||||||
*Rails 3.2.0 (unreleased)*
|
*Rails 3.2.0 (unreleased)*
|
||||||
|
|
||||||
* Added Time#whole_day/week/quarter/year as a way of generating ranges (example: Event.where(created_at: Time.now.whole_week)) [DHH]
|
* Added Time#all_day/week/quarter/year as a way of generating ranges (example: Event.where(created_at: Time.now.all_week)) [DHH]
|
||||||
|
|
||||||
* Added instance_accessor: false as an option to Class#cattr_accessor and friends [DHH]
|
* Added instance_accessor: false as an option to Class#cattr_accessor and friends [DHH]
|
||||||
|
|
||||||
|
@ -249,27 +249,27 @@ def tomorrow
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Returns a Range representing the whole day of the current time.
|
# Returns a Range representing the whole day of the current time.
|
||||||
def whole_day
|
def all_day
|
||||||
beginning_of_day..end_of_day
|
beginning_of_day..end_of_day
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a Range representing the whole week of the current time.
|
# Returns a Range representing the whole week of the current time.
|
||||||
def whole_week
|
def all_week
|
||||||
beginning_of_week..end_of_week
|
beginning_of_week..end_of_week
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a Range representing the whole month of the current time.
|
# Returns a Range representing the whole month of the current time.
|
||||||
def whole_month
|
def all_month
|
||||||
beginning_of_month..end_of_month
|
beginning_of_month..end_of_month
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a Range representing the whole quarter of the current time.
|
# Returns a Range representing the whole quarter of the current time.
|
||||||
def whole_quarter
|
def all_quarter
|
||||||
beginning_of_quarter..end_of_quarter
|
beginning_of_quarter..end_of_quarter
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a Range representing the whole year of the current time.
|
# Returns a Range representing the whole year of the current time.
|
||||||
def whole_year
|
def all_year
|
||||||
beginning_of_year..end_of_year
|
beginning_of_year..end_of_year
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -767,24 +767,24 @@ def test_case_equality
|
|||||||
assert_equal false, Time === DateTime.civil(2000)
|
assert_equal false, Time === DateTime.civil(2000)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_whole_day
|
def test_all_day
|
||||||
assert_equal Time.local(2011,6,7,0,0,0)..Time.local(2011,6,7,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).whole_day
|
assert_equal Time.local(2011,6,7,0,0,0)..Time.local(2011,6,7,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).all_day
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_whole_week
|
def test_all_week
|
||||||
assert_equal Time.local(2011,6,6,0,0,0)..Time.local(2011,6,12,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).whole_week
|
assert_equal Time.local(2011,6,6,0,0,0)..Time.local(2011,6,12,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).all_week
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_whole_month
|
def test_all_month
|
||||||
assert_equal Time.local(2011,6,1,0,0,0)..Time.local(2011,6,30,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).whole_month
|
assert_equal Time.local(2011,6,1,0,0,0)..Time.local(2011,6,30,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).all_month
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_whole_quarter
|
def test_all_quarter
|
||||||
assert_equal Time.local(2011,4,1,0,0,0)..Time.local(2011,6,30,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).whole_quarter
|
assert_equal Time.local(2011,4,1,0,0,0)..Time.local(2011,6,30,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).all_quarter
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_whole_year
|
def test_all_year
|
||||||
assert_equal Time.local(2011,1,1,0,0,0)..Time.local(2011,12,31,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).whole_year
|
assert_equal Time.local(2011,1,1,0,0,0)..Time.local(2011,12,31,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).all_year
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
Loading…
Reference in New Issue
Block a user