Class: LongTweet::Master

Inherits:
Object
  • Object
show all
Defined in:
lib/long_tweet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, agent) ⇒ Master

Returns a new instance of Master.



16
17
18
19
20
21
# File 'lib/long_tweet.rb', line 16

def initialize text, agent
  @text = text
  @agent = agent
  create_ordered_tweets
  configure_agent
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



15
16
17
# File 'lib/long_tweet.rb', line 15

def agent
  @agent
end

#textObject (readonly)

Returns the value of attribute text.



15
16
17
# File 'lib/long_tweet.rb', line 15

def text
  @text
end

#tweetsObject (readonly)

Returns the value of attribute tweets.



15
16
17
# File 'lib/long_tweet.rb', line 15

def tweets
  @tweets
end

Instance Method Details

#configure_agentObject



23
24
25
# File 'lib/long_tweet.rb', line 23

def configure_agent
  Config.new(agent).configure
end

#create_ordered_tweetsObject



27
28
29
30
# File 'lib/long_tweet.rb', line 27

def create_ordered_tweets
  tweets = Splitter.new(text).split
  @tweets = Arranger.new(tweets).order
end

#postObject



32
33
34
35
# File 'lib/long_tweet.rb', line 32

def post
  tweets.each(&:post)
  puts "Sending Tweet: #{text}"
end