Class: ChiefEditor
- Inherits:
-
Object
- Object
- ChiefEditor
- Defined in:
- app/core/chief_editor.rb
Overview
The ChiefEditor is the guy that makes all the reporters work
Instance Method Summary collapse
- #buttons_for(reporter_name) ⇒ Object
-
#employ(reporter) ⇒ Object
Adds the given reporter to the set of reporters employed by the editor.
- #headline_with(reporter_name, rid) ⇒ Object
-
#initialize(conf = SettingsProvider.new, fetcher = ReporterFetcher.new) ⇒ ChiefEditor
constructor
A new instance of ChiefEditor.
- #latest_news_from(reporter_name) ⇒ Object
- #news_from(reporter_name) ⇒ Object
- #reporter_with(reporter_name) ⇒ Object
- #title_for(reporter_name) ⇒ Object
Constructor Details
#initialize(conf = SettingsProvider.new, fetcher = ReporterFetcher.new) ⇒ ChiefEditor
Returns a new instance of ChiefEditor.
28 29 30 31 32 33 34 35 36 |
# File 'app/core/chief_editor.rb', line 28 def initialize(conf=SettingsProvider.new, fetcher=ReporterFetcher.new) @reporters = Hash.new fetcher = CacheReporterFetcher.new(fetcher, conf) unless conf.update_interval == 0 fetcher.active_reporters.each do |reporter| self.employ(reporter) end end |
Instance Method Details
#buttons_for(reporter_name) ⇒ Object
59 60 61 62 |
# File 'app/core/chief_editor.rb', line 59 def (reporter_name) reporter = @reporters[reporter_name] return reporter. end |
#employ(reporter) ⇒ Object
Adds the given reporter to the set of reporters employed by the editor
65 66 67 |
# File 'app/core/chief_editor.rb', line 65 def employ(reporter) @reporters.update(reporter.name => reporter) end |
#headline_with(reporter_name, rid) ⇒ Object
50 51 52 |
# File 'app/core/chief_editor.rb', line 50 def headline_with(reporter_name, rid) @reporters[reporter_name].headline(rid) end |
#latest_news_from(reporter_name) ⇒ Object
38 39 40 |
# File 'app/core/chief_editor.rb', line 38 def latest_news_from(reporter_name) @reporters[reporter_name].latest_headlines end |
#news_from(reporter_name) ⇒ Object
42 43 44 |
# File 'app/core/chief_editor.rb', line 42 def news_from(reporter_name) @reporters[reporter_name].headlines end |
#reporter_with(reporter_name) ⇒ Object
46 47 48 |
# File 'app/core/chief_editor.rb', line 46 def reporter_with(reporter_name) @reporters[reporter_name] end |
#title_for(reporter_name) ⇒ Object
54 55 56 57 |
# File 'app/core/chief_editor.rb', line 54 def title_for(reporter_name) reporter = @reporters[reporter_name] return reporter.channel_title end |