Skip to content

Instantly share code, notes, and snippets.

@taiansu
Last active October 2, 2015 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taiansu/2215605 to your computer and use it in GitHub Desktop.
Save taiansu/2215605 to your computer and use it in GitHub Desktop.
The Kid back in town.
def char_to_block(sentence_ary, &block)
if block_given? then
sentence_ary.each do |sentence|
sentence.split(//).each do |char|
block.call(char)
end
puts
end
else
puts sentence_ary.join("\n");
end
puts
end
if __FILE__ == $0
sentence = ["Hello word, again. Here's the kid back in town.",
"I know, it's bee a pretty while.", "I know."]
char_to_block(sentence) { |char|
sleep(0.2)
print char
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment