Sha256: 24bced73796d5a535d3495701260a2616c455bf2e38b60b9f07470f1451422d3
Contents?: true
Size: 985 Bytes
Versions: 1
Compression:
Stored size: 985 Bytes
Contents
module Beet module Interaction # Print text to the console # # ==== Example # # say("This is the default. You probably shouldn't change it.") # def say(string) puts "\n#{string}" end # Get a user's input # # ==== Example # # answer = ask("Should I freeze the latest Rails?") # freeze! if ask("Should I freeze the latest Rails?") == "yes" # def ask(string) say(string) print '> ' STDIN.gets.strip end # Helper to test if the user says yes(y)? # # ==== Example # # freeze! if yes?("Should I freeze the latest Rails?") # def yes?(question) answer = ask(question).downcase answer == "y" || answer == "yes" end # Helper to test if the user does NOT say yes(y)? # # ==== Example # # capify! if no?("Will you be using vlad to deploy your application?") # def no?(question) !yes?(question) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
whtt-eric-beet-0.6.10 | lib/beet/interaction.rb |