Module: Ronin::DB::Model::Importable::ClassMethods
- Defined in:
- lib/ronin/db/model/importable.rb
Overview
Class-methods which will be added to the model.
Instance Method Summary collapse
-
#find_or_import(value) ⇒ ActiveRecord::Base
Finds or imports a new record.
-
#import(value) ⇒ ActiveRecord::Base
abstract
Imports a record from the given value.
-
#lookup(value) ⇒ ActiveRecord::Base?
Looks up a record with the given value.
Instance Method Details
#find_or_import(value) ⇒ ActiveRecord::Base
Finds or imports a new record.
81 82 83 |
# File 'lib/ronin/db/model/importable.rb', line 81 def find_or_import(value) lookup(value) || import(value) end |
#import(value) ⇒ ActiveRecord::Base
This method is abstract.
Imports a record from the given value.
68 69 70 |
# File 'lib/ronin/db/model/importable.rb', line 68 def import(value) raise(NotImplementedError,"#{self} did not define a self.import method") end |
#lookup(value) ⇒ ActiveRecord::Base?
Looks up a record with the given value.
53 54 55 |
# File 'lib/ronin/db/model/importable.rb', line 53 def lookup(value) raise(NotImplementedError,"#{self} did not define a self.lookup method") end |