Class: Pickle::Adapter::Fabrication
- Inherits:
-
Pickle::Adapter
- Object
- Pickle::Adapter
- Pickle::Adapter::Fabrication
- Defined in:
- lib/pickle/adapter.rb
Overview
fabrication adapter
Instance Attribute Summary
Attributes inherited from Pickle::Adapter
Class Method Summary collapse
Instance Method Summary collapse
- #create(attrs = {}) ⇒ Object
-
#initialize(factory) ⇒ Fabrication
constructor
A new instance of Fabrication.
Methods inherited from Pickle::Adapter
column_names, create_model, find_all_models, find_first_model, get_model, model_classes
Constructor Details
#initialize(factory) ⇒ Fabrication
Returns a new instance of Fabrication.
154 155 156 157 158 |
# File 'lib/pickle/adapter.rb', line 154 def initialize(factory) if defined? ::Fabrication @klass, @name = factory[1].klass, factory[0].to_s end end |
Class Method Details
.factories ⇒ Object
145 146 147 148 149 150 151 152 |
# File 'lib/pickle/adapter.rb', line 145 def self.factories if defined? ::Fabrication ::Fabrication.manager.load_definitions if ::Fabrication.manager.schematics.empty? ::Fabrication.manager.schematics.map { |name, klass| new([name, klass]) } else [] end end |
Instance Method Details
#create(attrs = {}) ⇒ Object
160 161 162 163 164 |
# File 'lib/pickle/adapter.rb', line 160 def create(attrs = {}) if defined? ::Fabrication Fabricate(@name.to_sym, attrs) end end |