Module: ORMivore::Port
- Included in:
- App::AccountStoragePort, App::AddressStoragePort
- Defined in:
- lib/ormivore/port.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #create(attrs) ⇒ Object
- #find(conditions, attributes_to_load, options = {}) ⇒ Object
-
#initialize(adapter) ⇒ Object
a good place to add generic storage functionality, like ‘around’ logging/performance monitoring/notifications/etc first obvious candidate is exception handling.
- #update(attrs, conditions) ⇒ Object
Class Method Details
.included(base) ⇒ Object
24 25 26 |
# File 'lib/ormivore/port.rb', line 24 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#create(attrs) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/ormivore/port.rb', line 42 def create(attrs) begin adapter.create(attrs) rescue => e raise ORMivore::StorageError, e. end end |
#find(conditions, attributes_to_load, options = {}) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/ormivore/port.rb', line 35 def find(conditions, attributes_to_load, = {}) # TODO verify conditions to contain only keys that match attribute names and value of proper type (, attributes_to_load) adapter.find(conditions, attributes_to_load, ) end |
#initialize(adapter) ⇒ Object
a good place to add generic storage functionality, like ‘around’ logging/performance monitoring/notifications/etc first obvious candidate is exception handling
31 32 33 |
# File 'lib/ormivore/port.rb', line 31 def initialize(adapter) @adapter = adapter end |
#update(attrs, conditions) ⇒ Object
50 51 52 53 54 |
# File 'lib/ormivore/port.rb', line 50 def update(attrs, conditions) adapter.update(attrs, conditions) rescue => e raise ORMivore::StorageError, e. end |