Class: Mailclerk::Outbox

Inherits:
Array
  • Object
show all
Defined in:
lib/outbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOutbox

Returns a new instance of Outbox.



5
6
7
# File 'lib/outbox.rb', line 5

def initialize
  self.enabled = false
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



3
4
5
# File 'lib/outbox.rb', line 3

def enabled
  @enabled
end

Instance Method Details

#add_send(request, response) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/outbox.rb', line 26

def add_send(request, response)
  email = OutboxEmail.new(
    OutboxEmail.recursive_init(
      response.merge(request)
    )
  )
  self << email
end

#enableObject



9
10
11
# File 'lib/outbox.rb', line 9

def enable
  self.enabled = true
end

#filter(query) ⇒ Object

Not just an alias for ‘select’



18
19
20
21
22
23
24
# File 'lib/outbox.rb', line 18

def filter(query)
  self.select do |email|
    query.all? do |key, value|
      email[key] == value
    end
  end
end

#resetObject



13
14
15
# File 'lib/outbox.rb', line 13

def reset
  self.clear
end