Class: NewRelic::Security::ParseCron::CronParser::InternalTime

Inherits:
Object
  • Object
show all
Defined in:
lib/newrelic_security/parse-cron/cron_parser.rb

Overview

internal “mutable” time representation

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dayObject

Returns the value of attribute day.



11
12
13
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 11

def day
  @day
end

#hourObject

Returns the value of attribute hour.



11
12
13
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 11

def hour
  @hour
end

#minObject

Returns the value of attribute min.



11
12
13
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 11

def min
  @min
end

#monthObject

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_sourceObject

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

#yearObject

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

#inspectObject



27
28
29
# File 'lib/newrelic_security/parse-cron/cron_parser.rb', line 27

def inspect
  [year, month, day, hour, min].inspect
end

#to_timeObject



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