Class: TelegramBot::Date
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
included
Constructor Details
#initialize(datetime) ⇒ Date
Returns a new instance of Date.
32
33
34
|
# File 'lib/telegram_bot/date.rb', line 32
def initialize(datetime)
@self.datetime = datetime
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &blk) ⇒ Object
36
37
38
|
# File 'lib/telegram_bot/date.rb', line 36
def method_missing(sym, *args, &blk)
@datetime.send(sym, *args, &blk)
end
|
Instance Attribute Details
#datetime ⇒ Object
Returns the value of attribute datetime.
30
31
32
|
# File 'lib/telegram_bot/date.rb', line 30
def datetime
@datetime
end
|
Class Method Details
.from(date) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/telegram_bot/date.rb', line 14
def self.from(date)
case date
when ::DateTime, ::Date, ::Time
new(date)
when Integer
new(Time.at(date).to_datetime)
when String
new(Datetime.parse(date))
when TelegramBot::Date
date
else
super
end
end
|
.members ⇒ Object
7
8
9
|
# File 'lib/telegram_bot/date.rb', line 7
def self.members
[]
end
|
Instance Method Details
#members ⇒ Object
10
11
12
|
# File 'lib/telegram_bot/date.rb', line 10
def members
self.class.members
end
|