class TweetingCake::CakeSupervisor
Public Instance Methods
supervise_cake_cutting()
click to toggle source
# File lib/tweeting_cake/cake_supervisor.rb, line 8 def supervise_cake_cutting twitter_handle = ask_for_twitter_handle tweeting_cake = TweetingCake.new( name_on_cake: twitter_handle ) cake_slicer = CakeSlicer.new(TwitterClient.new) give_cake_slicing_instructions wait_for_cake_to_get_sliced cake_slicer.serve_a_slice_from(tweeting_cake) end
Private Instance Methods
ask_for_twitter_handle()
click to toggle source
# File lib/tweeting_cake/cake_supervisor.rb, line 28 def ask_for_twitter_handle puts "what is your twitter handle?" STDOUT.flush gets.chomp end
give_cake_slicing_instructions()
click to toggle source
# File lib/tweeting_cake/cake_supervisor.rb, line 23 def give_cake_slicing_instructions puts "Now cut the cake with the cake slicer!" STDOUT.flush end
wait_for_cake_to_get_sliced()
click to toggle source
# File lib/tweeting_cake/cake_supervisor.rb, line 34 def wait_for_cake_to_get_sliced loop do system("stty raw -echo") char = STDIN.read_nonblock(1) rescue nil system("stty -raw echo") break if / /i =~ char exit if /x/i =~ char end end