# File lib/dynflow/coordinator.rb, line 35 def self.constantize(name) Serializable.constantize(name) rescue NameError # If we don't find the lock name, return the most generic version Record end
# File lib/dynflow/coordinator.rb, line 42 def initialize(*args) @data ||= {} @data = Utils.indifferent_hash(@data.merge(class: self.class.name)) end
# File lib/dynflow/coordinator.rb, line 31 def self.new_from_hash(hash) self.allocate.tap { |record| record.from_hash(hash) } end
# File lib/dynflow/coordinator.rb, line 73 def ==(other_object) self.class == other_object.class && self.id == other_object.id end
# File lib/dynflow/coordinator.rb, line 47 def from_hash(hash) @data = hash @from_hash = true end
# File lib/dynflow/coordinator.rb, line 77 def hash [self.class, self.id].hash end
# File lib/dynflow/coordinator.rb, line 56 def id @data[:id] end
# File lib/dynflow/coordinator.rb, line 52 def to_hash @data end
# File lib/dynflow/coordinator.rb, line 69 def to_s "#{self.class.name}: #{id}" end
@api override check to be performed before we try to acquire the lock
# File lib/dynflow/coordinator.rb, line 62 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