Class: Chronos::Calendar::Gregorian
Constant Summary
collapse
- Inspect =
"#<%s %s>".freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(datetime) ⇒ Gregorian
Returns a new instance of Gregorian.
27
28
29
30
|
# File 'lib/chronos/calendar/gregorian.rb', line 27
def initialize(datetime)
@datetime = datetime
@language = datetime.language
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
76
77
78
79
80
81
82
83
84
|
# File 'lib/chronos/calendar/gregorian.rb', line 76
def method_missing(*args, &block)
r = @datetime.send(*args, &block)
if r.class == ::Chronos::Datetime::Gregorian then
@datetime = r
self
else
r
end
end
|
Class Method Details
.method_missing(*args, &block) ⇒ Object
22
23
24
|
# File 'lib/chronos/calendar/gregorian.rb', line 22
def method_missing(*args, &block)
new(Chronos::Datetime::Gregorian.send(*args, &block))
end
|
Instance Method Details
#inspect ⇒ Object
86
87
88
89
90
91
|
# File 'lib/chronos/calendar/gregorian.rb', line 86
def inspect
sprintf Inspect,
self.class,
@datetime
end
|
#microsecond=(value) ⇒ Object
#millisecond=(value) ⇒ Object
#month=(value) ⇒ Object
36
37
38
|
# File 'lib/chronos/calendar/gregorian.rb', line 36
def month=(value)
@datetime += Chronos::Duration::Gregorian.new(0, (value-@datetime.month()), @language)
end
|
#nanosecond=(value) ⇒ Object
#picosecond=(value) ⇒ Object
72
73
74
|
# File 'lib/chronos/calendar/gregorian.rb', line 72
def picosecond=(value)
@datetime += Chronos::Duration::Gregorian.new((value-@datetime.picosecond())*Chronos::PS_IN_PICOSECOND, 0, @language)
end
|
#year=(value) ⇒ Object
32
33
34
|
# File 'lib/chronos/calendar/gregorian.rb', line 32
def year=(value)
@datetime += Chronos::Duration::Gregorian.new(0, (value-@datetime.year())*12, @language)
end
|