Class: Todo::Src::Io
- Inherits:
-
Object
- Object
- Todo::Src::Io
- Defined in:
- lib/todo/src/io.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Io
constructor
A new instance of Io.
- #read ⇒ Object
- #write(lines) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Io
Returns a new instance of Io.
6 7 8 |
# File 'lib/todo/src/io.rb', line 6 def initialize(opts = {}) @opts = opts end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
4 5 6 |
# File 'lib/todo/src/io.rb', line 4 def opts @opts end |
Instance Method Details
#read ⇒ Object
10 11 12 |
# File 'lib/todo/src/io.rb', line 10 def read @lines ||= input.readlines.map(&:rstrip) end |
#write(lines) ⇒ Object
14 15 16 |
# File 'lib/todo/src/io.rb', line 14 def write(lines) output.puts(lines.join("\n")) end |