Class: Cardigan::Io
- Inherits:
-
Object
- Object
- Cardigan::Io
- Defined in:
- lib/cardigan/io.rb
Instance Method Summary collapse
- #ask(prompt) ⇒ Object
-
#initialize(in_io = $stdin, out_io = $stdout) ⇒ Io
constructor
A new instance of Io.
- #say(message = '') ⇒ Object
Constructor Details
#initialize(in_io = $stdin, out_io = $stdout) ⇒ Io
Returns a new instance of Io.
3 4 5 |
# File 'lib/cardigan/io.rb', line 3 def initialize in_io=$stdin, out_io=$stdout @in_io, @out_io = in_io, out_io end |
Instance Method Details
#ask(prompt) ⇒ Object
7 8 9 10 |
# File 'lib/cardigan/io.rb', line 7 def ask prompt @out_io.print "#{prompt} > " @in_io.gets.chomp end |
#say(message = '') ⇒ Object
12 13 14 |
# File 'lib/cardigan/io.rb', line 12 def say ='' @out_io.puts end |