Class: Floom::Status
- Inherits:
-
Object
- Object
- Floom::Status
- Defined in:
- lib/floom/models/status.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Status
constructor
A new instance of Status.
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Status
Returns a new instance of Status.
17 18 19 20 21 22 23 24 |
# File 'lib/floom/models/status.rb', line 17 def initialize( = {}) @state = [:node_state] @version = [:version] @last_seen = [:last_seen] @host = [:host] @physical_node = [:physical_node] @delta = [:delta] end |
Class Method Details
.parse(status) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/floom/models/status.rb', line 6 def parse(status) new(state: status.state, version: status.version, last_seen: status.lastseen, host: status.host, physical_node: status.physicalNode, delta: status.lastSeenDeltaMillis).to_hash end |
Instance Method Details
#to_hash ⇒ Object
26 27 28 |
# File 'lib/floom/models/status.rb', line 26 def to_hash self.instance_variables.inject({}){ |hsh, var| hsh[var.to_s.slice(1..-1).to_sym] = self.instance_variable_get(var) ; hsh } end |