Class: Wire::StateEntry
- Inherits:
-
Object
- Object
- Wire::StateEntry
- Defined in:
- lib/wire/model/state.rb
Overview
A StateEntry combines a resource type, a resource and the state
Instance Attribute Summary collapse
-
#name ⇒ Object
typei.e. -
#state ⇒ Object
typei.e. -
#type ⇒ Object
typei.e.
Instance Method Summary collapse
-
#initialize(type, name, state = :unknown) ⇒ StateEntry
constructor
initializes the state entry with given
typeandnameandstatesets :unknown state ifstatenot given. -
#to_pretty_s ⇒ Object
readble string repr for output.
-
#to_s ⇒ Object
string representation.
Constructor Details
#initialize(type, name, state = :unknown) ⇒ StateEntry
initializes the state entry with given type and name and state sets :unknown state if state not given
139 140 141 142 143 |
# File 'lib/wire/model/state.rb', line 139 def initialize(type, name, state = :unknown) self.type = type self.name = name self.state = state end |
Instance Attribute Details
#name ⇒ Object
type i.e. :bridge name i.e. :br0 state, one of :up, :down, :unknown
134 135 136 |
# File 'lib/wire/model/state.rb', line 134 def name @name end |
#state ⇒ Object
type i.e. :bridge name i.e. :br0 state, one of :up, :down, :unknown
134 135 136 |
# File 'lib/wire/model/state.rb', line 134 def state @state end |
#type ⇒ Object
type i.e. :bridge name i.e. :br0 state, one of :up, :down, :unknown
134 135 136 |
# File 'lib/wire/model/state.rb', line 134 def type @type end |
Instance Method Details
#to_pretty_s ⇒ Object
readble string repr for output
151 152 153 |
# File 'lib/wire/model/state.rb', line 151 def to_pretty_s "#{type}:#{name} is #{state}" end |
#to_s ⇒ Object
string representation
146 147 148 |
# File 'lib/wire/model/state.rb', line 146 def to_s "State:[type=#{type}, name=#{name}, state=#{state}]" end |