Class: Bluplate::Inbox

Inherits:
Object
  • Object
show all
Includes:
Persist::Base
Defined in:
lib/bluplate/inbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Persist::Base

included, #save

Constructor Details

#initialize(opts = {}) ⇒ Inbox

Returns a new instance of Inbox.



7
8
9
10
# File 'lib/bluplate/inbox.rb', line 7

def initialize(opts={})
  @tasks = {}
  @sources = opts[:sources]
end

Instance Attribute Details

#sourcesObject

Returns the value of attribute sources.



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

def sources
  @sources
end

#tasksObject

Returns the value of attribute tasks.



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

def tasks
  @tasks
end

Instance Method Details

#retrieveObject



16
17
18
19
20
# File 'lib/bluplate/inbox.rb', line 16

def retrieve 
  if @sources && !@sources.empty? 
    @sources.inject(@tasks){|e, i| e + i.import}
  end
end

#to_hashObject



12
13
14
# File 'lib/bluplate/inbox.rb', line 12

def to_hash
  {:tasks => @tasks }
end