Class: Proposal::Adapter

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Adapter

Returns a new instance of Adapter.



15
16
17
# File 'lib/proposal/engine.rb', line 15

def initialize options
  @options = options
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 options
  Token.where options
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, options = {}
  Token.find_or_new @options.merge(options).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
  @options.merge! arguments: arguments
  self
end