Class: ChiefEditor

Inherits:
Object
  • Object
show all
Defined in:
app/core/chief_editor.rb

Overview

The ChiefEditor is the guy that makes all the reporters work

Instance Method Summary collapse

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 buttons_for(reporter_name)
  reporter = @reporters[reporter_name]
  return reporter.buttons
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