# -*- coding: utf-8 -*- require 'twitter' module ConsadoleAggregator module Live module Builder class Twit def initialize Process.daemon(true, false) @client = Twitter::Client.from_config('config/account.yaml') @posted = [] end def post new_line.each do |line| @client.status(:post, "#{line.time} #{line.post} #consadole") @posted << line end end def reserve start_time start = Time.parse start_time ConsadoleAggregator::log.info("#{start.to_time}くらいにはじめる予定") sleep start - Time.now live end def live # サッカーはハーフタイム含めて120分位あれば終わる 120.times do post sleep 60 end end private def new_line ConsadoleAggregator::Live::Parser.parse - @posted end end end end end