Class: NewRelic::Security::ParseCron::CronParser::InternalTime
- Inherits:
-
Object
- Object
- NewRelic::Security::ParseCron::CronParser::InternalTime
- Defined in:
- lib/newrelic_security/parse-cron/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.
13 14 15 16 17 18 19 20 21 |
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 13 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.
11 12 13 |
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 11 def day @day end |
#hour ⇒ Object
Returns the value of attribute hour.
11 12 13 |
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 11 def hour @hour end |
#min ⇒ Object
Returns the value of attribute min.
11 12 13 |
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 11 def min @min end |
#month ⇒ Object
Returns the value of attribute month.
11 12 13 |
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 11 def month @month end |
#time_source ⇒ Object
Returns the value of attribute time_source.
11 12 13 |
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 11 def time_source @time_source end |
#year ⇒ Object
Returns the value of attribute year.
11 12 13 |
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 11 def year @year end |
Instance Method Details
#inspect ⇒ Object
27 28 29 |
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 27 def inspect [year, month, day, hour, min].inspect end |
#to_time ⇒ Object
23 24 25 |
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 23 def to_time time_source.local(@year, @month, @day, @hour, @min, 0) end |