Class: Woodhouse::Watchdog::Transition
- Inherits:
-
Object
- Object
- Woodhouse::Watchdog::Transition
- Defined in:
- lib/woodhouse/watchdog.rb
Instance Attribute Summary collapse
-
#new ⇒ Object
readonly
Returns the value of attribute new.
-
#old ⇒ Object
readonly
Returns the value of attribute old.
Instance Method Summary collapse
- #duration ⇒ Object
- #duration_s ⇒ Object
-
#initialize(old, new) ⇒ Transition
constructor
A new instance of Transition.
- #message ⇒ Object
- #name ⇒ Object
- #new_name ⇒ Object
- #old_name ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(old, new) ⇒ Transition
Returns a new instance of Transition.
67 68 69 70 |
# File 'lib/woodhouse/watchdog.rb', line 67 def initialize(old, new) @old = old @new = new end |
Instance Attribute Details
#new ⇒ Object (readonly)
Returns the value of attribute new.
65 66 67 |
# File 'lib/woodhouse/watchdog.rb', line 65 def new @new end |
#old ⇒ Object (readonly)
Returns the value of attribute old.
65 66 67 |
# File 'lib/woodhouse/watchdog.rb', line 65 def old @old end |
Instance Method Details
#duration ⇒ Object
88 89 90 |
# File 'lib/woodhouse/watchdog.rb', line 88 def duration old && new.time - old.time end |
#duration_s ⇒ Object
92 93 94 |
# File 'lib/woodhouse/watchdog.rb', line 92 def duration_s duration && " (#{duration}s)" end |
#message ⇒ Object
84 85 86 |
# File 'lib/woodhouse/watchdog.rb', line 84 def new. end |
#name ⇒ Object
72 73 74 |
# File 'lib/woodhouse/watchdog.rb', line 72 def name "#{old_name} -> #{new_name}" end |
#new_name ⇒ Object
80 81 82 |
# File 'lib/woodhouse/watchdog.rb', line 80 def new_name new && new.name end |
#old_name ⇒ Object
76 77 78 |
# File 'lib/woodhouse/watchdog.rb', line 76 def old_name old && old.name end |
#to_s ⇒ Object
96 97 98 |
# File 'lib/woodhouse/watchdog.rb', line 96 def to_s "{ #{name} } #{}#{duration_s}" end |