Class: MailProvider::SourceManager
- Inherits:
-
Object
- Object
- MailProvider::SourceManager
- Defined in:
- lib/mail_provider/source_manager.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(path = nil, directory = nil) ⇒ SourceManager
constructor
A new instance of SourceManager.
- #run(refresh: false) ⇒ Object
Constructor Details
#initialize(path = nil, directory = nil) ⇒ SourceManager
Returns a new instance of SourceManager.
7 8 9 10 11 |
# File 'lib/mail_provider/source_manager.rb', line 7 def initialize(path = nil, directory = nil) @path = path || File.join(MailProvider::ROOT_DIR, 'sources.txt') @directory = directory || File.join(MailProvider::ROOT_DIR, 'sources') @missing = unavailable_sources end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
5 6 7 |
# File 'lib/mail_provider/source_manager.rb', line 5 def directory @directory end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/mail_provider/source_manager.rb', line 5 def path @path end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
5 6 7 |
# File 'lib/mail_provider/source_manager.rb', line 5 def total @total end |
Instance Method Details
#run(refresh: false) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/mail_provider/source_manager.rb', line 13 def run(refresh: false) @missing = refresh ? sources : unavailable_sources download save sources # fetch sources again to update total count end |