Class: Postjob::Host
Constant Summary collapse
- UUID_REGEXP =
/\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/i
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Methods inherited from Record
Constructor Details
This class inherits a constructor from Postjob::Record
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/postjob/host.rb', line 6 def attributes @attributes end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
8 9 10 |
# File 'lib/postjob/host.rb', line 8 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/postjob/host.rb', line 5 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/postjob/host.rb', line 7 def status @status end |
Class Method Details
.clear_storage ⇒ Object
11 12 13 14 15 |
# File 'lib/postjob/host.rb', line 11 def clear_storage @host_id = nil File.unlink(storage_path) if File.exist?(storage_path) end |
.host_id ⇒ Object
28 29 30 |
# File 'lib/postjob/host.rb', line 28 def host_id @host_id ||= atomic_set_and_get(storage_path) { register_host(host_id: nil) } end |
.host_id=(host_id) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/postjob/host.rb', line 19 def host_id=(host_id) expect! host_id => UUID_REGEXP return if @host_id == host_id register_host(host_id: host_id) @host_id = host_id end |