Class: Proposal::Adapter
- Inherits:
-
Object
- Object
- Proposal::Adapter
- Defined in:
- lib/proposal/engine.rb
Overview
Wrapper object for the ORM. In this case it only supports ActiveRecord. In theory you could write an Adapter for each different ORM then use the rails initializer to add.
Class Method Summary collapse
-
.where(options) ⇒ Object
Delegates to ORM object and returns all proposal objects for given type.
Instance Method Summary collapse
-
#initialize(options) ⇒ Adapter
constructor
A new instance of Adapter.
-
#to(email, options = {}) ⇒ Object
Method to return in instantiate the proposal object using an email address.
- #with(arguments) ⇒ Object (also: #with_args)
Constructor Details
#initialize(options) ⇒ Adapter
Returns a new instance of Adapter.
15 16 17 |
# File 'lib/proposal/engine.rb', line 15 def initialize = end |
Class Method Details
.where(options) ⇒ Object
Delegates to ORM object and returns all proposal objects for given type.
33 34 35 |
# File 'lib/proposal/engine.rb', line 33 def self.where Token.where end |
Instance Method Details
#to(email, options = {}) ⇒ Object
Method to return in instantiate the proposal object using an email address.
28 29 30 |
# File 'lib/proposal/engine.rb', line 28 def to email, = {} Token.find_or_new .merge().merge email: email end |
#with(arguments) ⇒ Object Also known as: with_args
19 20 21 22 |
# File 'lib/proposal/engine.rb', line 19 def with arguments .merge! arguments: arguments self end |