Class: ConsadoleAggregator::Live
- Inherits:
-
Object
- Object
- ConsadoleAggregator::Live
- Defined in:
- lib/consadole_aggregator/live.rb
Defined Under Namespace
Classes: Runner
Instance Attribute Summary collapse
-
#posted ⇒ Object
readonly
Returns the value of attribute posted.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Live
constructor
A new instance of Live.
- #update ⇒ Object
Constructor Details
#initialize ⇒ Live
Returns a new instance of Live.
53 54 55 |
# File 'lib/consadole_aggregator/live.rb', line 53 def initialize @posted = [] end |
Instance Attribute Details
#posted ⇒ Object (readonly)
Returns the value of attribute posted.
51 52 53 |
# File 'lib/consadole_aggregator/live.rb', line 51 def posted @posted end |
Class Method Details
.run(starting_time, opt = {}) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/consadole_aggregator/live.rb', line 43 def self.run starting_time, opt = {} runner = Runner.new starting_time runner.length_of_a_game = opt[:length_of_a_game] if opt[:length_of_a_game] runner.interval = opt[:interval] if opt[:interval] runner.daemonize = opt[:daemonize] unless opt[:daemonize].nil? runner.run &opt[:writer] end |
Instance Method Details
#update ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/consadole_aggregator/live.rb', line 57 def update self.class .fetch .reject(&@posted.method(:include?)) .each_with_object(@posted) { |post, posted| begin yield({ title: post }) if block_given? posted << post ConsadoleAggregator.logger.info post rescue ConsadoleAggregator.logger.error $! end } end |