Class: Pickle::Adapter
- Inherits:
-
Object
show all
- Defined in:
- lib/pickle/adapter.rb
Overview
Abstract Factory adapter class, if you have a factory type setup, you can
easily create an adaptor to make it work with Pickle.
The factory adaptor must have a #factories class method that returns its
instances, and each instance must respond to:
Defined Under Namespace
Modules: Base
Classes: Fabrication, FactoryGirl, Machinist, Orm
Instance Attribute Summary (collapse)
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Instance Attribute Details
- (Object) klass
Returns the value of attribute klass
14
15
16
|
# File 'lib/pickle/adapter.rb', line 14
def klass
@klass
end
|
- (Object) name
Returns the value of attribute name
14
15
16
|
# File 'lib/pickle/adapter.rb', line 14
def name
@name
end
|
Class Method Details
+ (Object) column_names(klass)
Returns the column names for the given ORM model class.
58
59
60
|
# File 'lib/pickle/adapter.rb', line 58
def column_names(klass)
klass.const_get(:PickleAdapter).column_names(klass)
end
|
+ (Object) create_model(klass, attributes)
74
75
76
|
# File 'lib/pickle/adapter.rb', line 74
def create_model(klass, attributes)
klass.const_get(:PickleAdapter).create_model(klass, attributes)
end
|
+ (Object) factories
49
50
51
|
# File 'lib/pickle/adapter.rb', line 49
def factories
raise NotImplementedError, "return an array of factory adapter objects"
end
|
+ (Object) find_all_models(klass, conditions)
70
71
72
|
# File 'lib/pickle/adapter.rb', line 70
def find_all_models(klass, conditions)
klass.const_get(:PickleAdapter).find_all_models(klass, conditions)
end
|
+ (Object) find_first_model(klass, conditions)
66
67
68
|
# File 'lib/pickle/adapter.rb', line 66
def find_first_model(klass, conditions)
klass.const_get(:PickleAdapter).find_first_model(klass, conditions)
end
|
+ (Object) get_model(klass, id)
62
63
64
|
# File 'lib/pickle/adapter.rb', line 62
def get_model(klass, id)
klass.const_get(:PickleAdapter).get_model(klass, id)
end
|
+ (Object) model_classes
53
54
55
|
# File 'lib/pickle/adapter.rb', line 53
def model_classes
@@model_classes ||= self::Base.adapters.map{ |a| a.model_classes }.flatten
end
|
Instance Method Details
- (Object) create(attrs = {})
16
17
18
|
# File 'lib/pickle/adapter.rb', line 16
def create(attrs = {})
raise NotImplementedError, "create and return an object with the given attributes"
end
|