Commit 7bab3d0b authored by take_cheeze's avatar take_cheeze

Implement day of week methods.

parent 02cabf8f
class Time
def sunday?; wday == 0 end
def monday?; wday == 1 end
def tuesday?; wday == 2 end
def wednesday?; wday == 3 end
def thursday?; wday == 4 end
def friday?; wday == 5 end
def saturday?; wday == 6 end
end
......@@ -197,5 +197,16 @@ if Object.const_defined?(:Time)
assert('Time#inspect') do
Time.at(1300000000.0).utc.inspect == "Sun Mar 13 07:06:40 UTC 2011"
end
assert('day of week methods') do
t = Time.gm(2012, 12, 24)
assert_false t.sunday?
assert_true t.monday?
assert_false t.tuesday?
assert_false t.wednesday?
assert_false t.thursday?
assert_false t.friday?
assert_false t.saturday?
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment