Class: Rtodotxt::List
- Inherits:
-
Array
- Object
- Array
- Rtodotxt::List
- Defined in:
- lib/rtodotxt.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(list) ⇒ List
constructor
A new instance of List.
-
#print ⇒ Object
Join the todo text together to return the list.
-
#read(str) ⇒ Object
Split a string by each line and generate an array of todos.
Constructor Details
#initialize(list) ⇒ List
Returns a new instance of List.
8 9 10 |
# File 'lib/rtodotxt.rb', line 8 def initialize list super self.class.gen_list_from_string list end |
Class Method Details
Instance Method Details
#print ⇒ Object
Join the todo text together to return the list
18 19 20 21 22 |
# File 'lib/rtodotxt.rb', line 18 def print str = self.map { |t| t.text }.join "\n" # the result must end with a newline! str << "\n" end |
#read(str) ⇒ Object
Split a string by each line and generate an array of todos
13 14 15 |
# File 'lib/rtodotxt.rb', line 13 def read str super self.class.gen_list_from_string str end |