Class: PassengerReaper::PsEtime
- Inherits:
-
Object
- Object
- PassengerReaper::PsEtime
- Defined in:
- lib/passenger_reaper/ps_etime.rb
Instance Attribute Summary collapse
-
#days ⇒ Object
Returns the value of attribute days.
-
#etime ⇒ Object
readonly
Returns the value of attribute etime.
-
#hours ⇒ Object
Returns the value of attribute hours.
-
#minutes ⇒ Object
Returns the value of attribute minutes.
-
#seconds ⇒ Object
Returns the value of attribute seconds.
Instance Method Summary collapse
- #age_in_seconds ⇒ Object
-
#initialize(raw_etime) ⇒ PsEtime
constructor
A new instance of PsEtime.
Constructor Details
#initialize(raw_etime) ⇒ PsEtime
Returns a new instance of PsEtime.
6 7 8 9 10 11 12 13 |
# File 'lib/passenger_reaper/ps_etime.rb', line 6 def initialize(raw_etime) @etime = raw_etime split_etime = @etime.split(/\-|\:/).map {|a| a.to_i} @seconds = split_etime[-1] || 0 @minutes = split_etime[-2] || 0 @hours = split_etime[-3] || 0 @days = split_etime[-4] || 0 end |
Instance Attribute Details
#days ⇒ Object
Returns the value of attribute days.
3 4 5 |
# File 'lib/passenger_reaper/ps_etime.rb', line 3 def days @days end |
#etime ⇒ Object (readonly)
Returns the value of attribute etime.
4 5 6 |
# File 'lib/passenger_reaper/ps_etime.rb', line 4 def etime @etime end |
#hours ⇒ Object
Returns the value of attribute hours.
3 4 5 |
# File 'lib/passenger_reaper/ps_etime.rb', line 3 def hours @hours end |
#minutes ⇒ Object
Returns the value of attribute minutes.
3 4 5 |
# File 'lib/passenger_reaper/ps_etime.rb', line 3 def minutes @minutes end |
#seconds ⇒ Object
Returns the value of attribute seconds.
3 4 5 |
# File 'lib/passenger_reaper/ps_etime.rb', line 3 def seconds @seconds end |
Instance Method Details
#age_in_seconds ⇒ Object
15 16 17 |
# File 'lib/passenger_reaper/ps_etime.rb', line 15 def age_in_seconds @seconds + (@minutes*60) + (@hours*3600) + (@days*86400) end |