Class: Scheduled::CronParser::InternalTime
- Inherits:
-
Object
- Object
- Scheduled::CronParser::InternalTime
- Defined in:
- lib/scheduled/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.
-
#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_source = Time) ⇒ InternalTime
constructor
A new instance of InternalTime.
- #inspect ⇒ Object
- #to_time ⇒ Object
Constructor Details
#initialize(time, time_source = Time) ⇒ InternalTime
Returns a new instance of InternalTime.
37 38 39 40 41 42 43 44 45 |
# File 'lib/scheduled/cron_parser.rb', line 37 def initialize(time,time_source = Time) @year = time.year @month = time.month @day = time.day @hour = time.hour @min = time.min @time_source = time_source end |
Instance Attribute Details
#day ⇒ Object
Returns the value of attribute day.
34 35 36 |
# File 'lib/scheduled/cron_parser.rb', line 34 def day @day end |
#hour ⇒ Object
Returns the value of attribute hour.
34 35 36 |
# File 'lib/scheduled/cron_parser.rb', line 34 def hour @hour end |
#min ⇒ Object
Returns the value of attribute min.
34 35 36 |
# File 'lib/scheduled/cron_parser.rb', line 34 def min @min end |
#month ⇒ Object
Returns the value of attribute month.
34 35 36 |
# File 'lib/scheduled/cron_parser.rb', line 34 def month @month end |
#time_source ⇒ Object
Returns the value of attribute time_source.
35 36 37 |
# File 'lib/scheduled/cron_parser.rb', line 35 def time_source @time_source end |
#year ⇒ Object
Returns the value of attribute year.
34 35 36 |
# File 'lib/scheduled/cron_parser.rb', line 34 def year @year end |
Instance Method Details
#inspect ⇒ Object
51 52 53 |
# File 'lib/scheduled/cron_parser.rb', line 51 def inspect [year, month, day, hour, min].inspect end |
#to_time ⇒ Object
47 48 49 |
# File 'lib/scheduled/cron_parser.rb', line 47 def to_time time_source.local(@year, @month, @day, @hour, @min, 0) end |