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.



27
28
29
30
31
32
33
34
35
# File 'app/core/chief_editor.rb', line 27

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



58
59
60
61
# File 'app/core/chief_editor.rb', line 58

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



64
65
66
# File 'app/core/chief_editor.rb', line 64

def employ(reporter)
  @reporters.update(reporter.name => reporter)
end

#headline_with(reporter_name, rid) ⇒ Object



49
50
51
# File 'app/core/chief_editor.rb', line 49

def headline_with(reporter_name, rid)
  @reporters[reporter_name].headline(rid)
end

#latest_news_from(reporter_name) ⇒ Object



37
38
39
# File 'app/core/chief_editor.rb', line 37

def latest_news_from(reporter_name)
  @reporters[reporter_name].latest_headlines
end

#news_from(reporter_name) ⇒ Object



41
42
43
# File 'app/core/chief_editor.rb', line 41

def news_from(reporter_name)
  @reporters[reporter_name].headlines
end

#reporter_with(reporter_name) ⇒ Object



45
46
47
# File 'app/core/chief_editor.rb', line 45

def reporter_with(reporter_name)
  @reporters[reporter_name]
end

#title_for(reporter_name) ⇒ Object



53
54
55
56
# File 'app/core/chief_editor.rb', line 53

def title_for(reporter_name)
  reporter = @reporters[reporter_name]
  return reporter.channel_title
end