class Dynflow::Coordinator::Record
Attributes
data[R]
Public Class Methods
constantize(name)
click to toggle source
# File lib/dynflow/coordinator.rb, line 36 def self.constantize(name) Serializable.constantize(name) rescue NameError # If we don't find the lock name, return the most generic version Record end
new(*args)
click to toggle source
# File lib/dynflow/coordinator.rb, line 43 def initialize(*args) @data = {} @data = Utils.indifferent_hash(@data.merge(class: self.class.name)) end
new_from_hash(hash)
click to toggle source
# File lib/dynflow/coordinator.rb, line 32 def self.new_from_hash(hash) self.allocate.tap { |record| record.from_hash(hash) } end
Public Instance Methods
==(other_object)
click to toggle source
# File lib/dynflow/coordinator.rb, line 74 def ==(other_object) self.class == other_object.class && self.id == other_object.id end
from_hash(hash)
click to toggle source
# File lib/dynflow/coordinator.rb, line 48 def from_hash(hash) @data = hash @from_hash = true end
hash()
click to toggle source
# File lib/dynflow/coordinator.rb, line 78 def hash [self.class, self.id].hash end
id()
click to toggle source
# File lib/dynflow/coordinator.rb, line 57 def id @data[:id] end
to_hash()
click to toggle source
# File lib/dynflow/coordinator.rb, line 53 def to_hash @data end
to_s()
click to toggle source
# File lib/dynflow/coordinator.rb, line 70 def to_s "#{self.class.name}: #{id}" end
validate!()
click to toggle source
@api override check to be performed before we try to acquire the lock
# File lib/dynflow/coordinator.rb, line 63 def validate! Type! id, String Type! @data, Hash raise "The record id %{s} too large" % id if id.size > 100 raise "The record class name %{s} too large" % self.class.name if self.class.name.size > 100 end