Class: DataMapper::Resource::VeneerInterface::ClassWrapper
Instance Attribute Summary
#klass, #opts
Instance Method Summary
collapse
#all, #create, #create!, #first, #initialize
Instance Method Details
#before_save(*methods) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/veneer/adapters/datamapper/class_wrapper.rb', line 23
def before_save(*methods)
klass.class_eval do
methods.each do |meth|
before :save, meth
end
end
end
|
#destroy_all ⇒ Object
9
10
11
|
# File 'lib/veneer/adapters/datamapper/class_wrapper.rb', line 9
def destroy_all
klass.all.destroy
end
|
#find_first(conditional) ⇒ Object
13
14
15
16
|
# File 'lib/veneer/adapters/datamapper/class_wrapper.rb', line 13
def find_first(conditional)
opts = opts_from_conditional_for_dm(conditional)
klass.first(opts)
end
|
#find_many(conditional) ⇒ Object
18
19
20
21
|
# File 'lib/veneer/adapters/datamapper/class_wrapper.rb', line 18
def find_many(conditional)
opts = opts_from_conditional_for_dm(conditional)
klass.all(opts)
end
|
#new(opts = {}) ⇒ Object
5
6
7
|
# File 'lib/veneer/adapters/datamapper/class_wrapper.rb', line 5
def new(opts = {})
::Kernel.Veneer(klass.new(opts))
end
|