Module: RPCMapper::Persistence::InstanceMethods

Defined in:
lib/rpc_mapper/persistence.rb

Instance Method Summary collapse

Instance Method Details

#[]=(attribute, value) ⇒ Object



18
19
20
# File 'lib/rpc_mapper/persistence.rb', line 18

def []=(attribute, value)
  set_attribute(attribute, value)
end

#attributes=(attributes) ⇒ Object



22
23
24
# File 'lib/rpc_mapper/persistence.rb', line 22

def attributes=(attributes)
  set_attributes(attributes)
end

#destroyObject Also known as: delete



43
44
45
# File 'lib/rpc_mapper/persistence.rb', line 43

def destroy
  write_adapter.delete(self) unless self.new_record?
end

#saveObject



26
27
28
# File 'lib/rpc_mapper/persistence.rb', line 26

def save
  write_adapter.write(self)
end

#save!Object



30
31
32
# File 'lib/rpc_mapper/persistence.rb', line 30

def save!
  save or raise RPCMapper::RecordNotSaved
end

#update_attributes(attributes) ⇒ Object



34
35
36
37
# File 'lib/rpc_mapper/persistence.rb', line 34

def update_attributes(attributes)
  self.attributes = attributes
  save
end

#update_attributes!(attributes) ⇒ Object



39
40
41
# File 'lib/rpc_mapper/persistence.rb', line 39

def update_attributes!(attributes)
  update_attributes(attributes) or raise RPCMapper::RecordNotSaved
end