class SequelMapper::AbstractRecord

Attributes

identity[R]
namespace[R]
raw_data[R]

Public Class Methods

new(namespace, identity, raw_data = {}) click to toggle source
# File lib/sequel_mapper/abstract_record.rb, line 7
def initialize(namespace, identity, raw_data = {})
  @namespace = namespace
  @identity = identity
  @raw_data = raw_data
end

Public Instance Methods

==(other) click to toggle source
# File lib/sequel_mapper/abstract_record.rb, line 36
def ==(other)
  self.class === other &&
    [operation, to_h] == [other.operation, other.to_h]
end
if_delete(&block) click to toggle source
# File lib/sequel_mapper/abstract_record.rb, line 24
def if_delete(&block)
  self
end
if_upsert(&block) click to toggle source
# File lib/sequel_mapper/abstract_record.rb, line 20
def if_upsert(&block)
  self
end
merge(more_data) click to toggle source
# File lib/sequel_mapper/abstract_record.rb, line 28
def merge(more_data)
  new_with_raw_data(raw_data.merge(more_data))
end
to_h() click to toggle source
# File lib/sequel_mapper/abstract_record.rb, line 32
def to_h
  raw_data.merge(identity)
end

Protected Instance Methods

operation() click to toggle source
# File lib/sequel_mapper/abstract_record.rb, line 43
def operation
  raise NotImplementedError
end

Private Instance Methods

new_with_raw_data(new_raw_data) click to toggle source
# File lib/sequel_mapper/abstract_record.rb, line 49
def new_with_raw_data(new_raw_data)
  self.class.new(namespace, identity, new_raw_data)
end