Class: CronParser::InternalTime
- Inherits:
-
Object
- Object
- CronParser::InternalTime
- Defined in:
- lib/cron_parser.rb
Overview
internal “mutable” time representation
Instance Attribute Summary collapse
-
#day ⇒ Object
Returns the value of attribute day.
-
#hour ⇒ Object
Returns the value of attribute hour.
-
#min ⇒ Object
Returns the value of attribute min.
-
#month ⇒ Object
Returns the value of attribute month.
-
#sec ⇒ Object
Returns the value of attribute sec.
-
#time_source ⇒ Object
Returns the value of attribute time_source.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(time = Time.now, time_source = Time) ⇒ InternalTime
constructor
A new instance of InternalTime.
- #inspect ⇒ Object
- #to_time ⇒ Object
Constructor Details
#initialize(time = Time.now, time_source = Time) ⇒ InternalTime
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cron_parser.rb', line 12 def initialize(time = Time.now, time_source = Time) @year = time.year @month = time.month @day = time.day @hour = time.hour @min = time.min @sec = time.sec @time_source = time_source end |
Instance Attribute Details
#day ⇒ Object
Returns the value of attribute day.
9 10 11 |
# File 'lib/cron_parser.rb', line 9 def day @day end |
#hour ⇒ Object
Returns the value of attribute hour.
9 10 11 |
# File 'lib/cron_parser.rb', line 9 def hour @hour end |
#min ⇒ Object
Returns the value of attribute min.
9 10 11 |
# File 'lib/cron_parser.rb', line 9 def min @min end |
#month ⇒ Object
Returns the value of attribute month.
9 10 11 |
# File 'lib/cron_parser.rb', line 9 def month @month end |
#sec ⇒ Object
Returns the value of attribute sec.
9 10 11 |
# File 'lib/cron_parser.rb', line 9 def sec @sec end |
#time_source ⇒ Object
Returns the value of attribute time_source.
10 11 12 |
# File 'lib/cron_parser.rb', line 10 def time_source @time_source end |
#year ⇒ Object
Returns the value of attribute year.
9 10 11 |
# File 'lib/cron_parser.rb', line 9 def year @year end |
Instance Method Details
#inspect ⇒ Object
27 28 29 |
# File 'lib/cron_parser.rb', line 27 def inspect [year, month, day, hour, min, sec].inspect end |
#to_time ⇒ Object
23 24 25 |
# File 'lib/cron_parser.rb', line 23 def to_time time_source.local(@year, @month, @day, @hour, @min, @sec) end |