Class: Fixnum
- Inherits:
-
Object
show all
- Defined in:
- lib/aaron/extensions.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/aaron/extensions.rb', line 27
def method_missing m, *args, &block
if /(.+)s$/.match(m.to_s) and self.respond_to?($1) self.send($1)
else
super
end
end
|
Instance Method Details
#day ⇒ Object
19
20
21
|
# File 'lib/aaron/extensions.rb', line 19
def day
hour * 24
end
|
#hour ⇒ Object
15
16
17
|
# File 'lib/aaron/extensions.rb', line 15
def hour
minute * 60
end
|
#minute ⇒ Object
11
12
13
|
# File 'lib/aaron/extensions.rb', line 11
def minute
second * 60
end
|
#second ⇒ Object
7
8
9
|
# File 'lib/aaron/extensions.rb', line 7
def second
self
end
|
#to(other) ⇒ Object
3
4
5
|
# File 'lib/aaron/extensions.rb', line 3
def to other
(self..other)
end
|
#week ⇒ Object
23
24
25
|
# File 'lib/aaron/extensions.rb', line 23
def week
day * 7
end
|