Class: Bumbleworks::Worker::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/bumbleworks/worker/proxy.rb

Constant Summary collapse

ProxiedAttributes =
[
  :id, :pid, :ip, :hostname, :system, :launched_at, :state, :name, :class, :uptime
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Proxy

Returns a new instance of Proxy.



11
12
13
14
15
16
# File 'lib/bumbleworks/worker/proxy.rb', line 11

def initialize(attributes)
  @raw_hash = attributes
  ProxiedAttributes.each do |key|
    instance_variable_set(:"@#{key}", attributes[key.to_s])
  end
end

Instance Attribute Details

#raw_hashObject (readonly)

Returns the value of attribute raw_hash.



8
9
10
# File 'lib/bumbleworks/worker/proxy.rb', line 8

def raw_hash
  @raw_hash
end

#state=(value) ⇒ Object (writeonly)

Sets the attribute state

Parameters:

  • value

    the value to set the attribute state to.



9
10
11
# File 'lib/bumbleworks/worker/proxy.rb', line 9

def state=(value)
  @state = value
end

Instance Method Details

#==(other) ⇒ Object



36
37
38
# File 'lib/bumbleworks/worker/proxy.rb', line 36

def ==(other)
  raw_hash == other.raw_hash
end

#class_nameObject



24
25
26
# File 'lib/bumbleworks/worker/proxy.rb', line 24

def class_name
  @class.to_s
end

#launched_atObject



28
29
30
31
32
33
34
# File 'lib/bumbleworks/worker/proxy.rb', line 28

def launched_at
  if @launched_at.is_a?(String)
    Time.parse(@launched_at)
  else
    @launched_at
  end
end

#storageObject

Allow storage to revert to the default for this Bumbleworks instance.



20
21
22
# File 'lib/bumbleworks/worker/proxy.rb', line 20

def storage
  nil
end