Class: Mail::TestRetriever
- Inherits:
-
Object
- Object
- Mail::TestRetriever
- Defined in:
- lib/mail/network/retriever_methods/test_retriever.rb
Instance Method Summary collapse
- #all(options = {}, &block) ⇒ Object
- #find(options = {}, &block) ⇒ Object
-
#initialize(values) ⇒ TestRetriever
constructor
A new instance of TestRetriever.
Constructor Details
#initialize(values) ⇒ TestRetriever
Returns a new instance of TestRetriever.
8 9 10 |
# File 'lib/mail/network/retriever_methods/test_retriever.rb', line 8 def initialize(values) @@emails = [] end |
Instance Method Details
#all(options = {}, &block) ⇒ Object
23 24 25 26 27 |
# File 'lib/mail/network/retriever_methods/test_retriever.rb', line 23 def all( = {}, &block) ||= {} [:count] = :all find(, &block) end |
#find(options = {}, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mail/network/retriever_methods/test_retriever.rb', line 12 def find( = {}, &block) emails = @@emails case count = [:count] when :all then emails when 1 then emails.first when Fixnum then emails[0, count] else raise 'Invalid count option value' end end |