Class: Wire::StateEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/wire/model/state.rb

Overview

A StateEntry combines a resource type, a resource and the state

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject

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

#stateObject

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

#typeObject

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_sObject

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_sObject

string representation



146
147
148
# File 'lib/wire/model/state.rb', line 146

def to_s
  "State:[type=#{type}, name=#{name}, state=#{state}]"
end