Class: DataMapper::Resource::VeneerInterface::InstanceWrapper

Inherits:
Veneer::Base::InstanceWrapper show all
Defined in:
lib/veneer/adapters/datamapper/instance_wrapper.rb

Instance Attribute Summary

Attributes inherited from Veneer::Base::InstanceWrapper

#instance, #options

Instance Method Summary collapse

Methods inherited from Veneer::Base::InstanceWrapper

#==, #class, #initialize, #method_missing, #update, #update!

Constructor Details

This class inherits a constructor from Veneer::Base::InstanceWrapper

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Veneer::Base::InstanceWrapper

Instance Method Details

#destroyObject



21
22
23
24
# File 'lib/veneer/adapters/datamapper/instance_wrapper.rb', line 21

def destroy
  instance.destroy
  self
end

#new_record?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/veneer/adapters/datamapper/instance_wrapper.rb', line 17

def new_record?
  instance.respond_to?(:new?) ? instance.new? : instance.new_record?
end

#saveObject



6
7
8
# File 'lib/veneer/adapters/datamapper/instance_wrapper.rb', line 6

def save
  instance.save
end

#save!Object



10
11
12
13
14
15
# File 'lib/veneer/adapters/datamapper/instance_wrapper.rb', line 10

def save!
  result = false
  result = instance.save
  raise ::Veneer::Errors::NotSaved unless result
  result
end