Class: Taskpaper::Document
- Inherits:
-
Object
- Object
- Taskpaper::Document
- Defined in:
- lib/taskpaper/document.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#filename ⇒ Object
Returns the value of attribute filename.
Instance Method Summary collapse
-
#initialize(file) ⇒ Document
constructor
———————.
- #inspect ⇒ Object
- #parse ⇒ Object
- #to_html ⇒ Object
- #to_json ⇒ Object
- #to_text ⇒ Object
Constructor Details
#initialize(file) ⇒ Document
16 17 18 19 20 |
# File 'lib/taskpaper/document.rb', line 16 def initialize(file) @filename = file @text = File.open(filename, "r").read parse end |
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
4 5 6 |
# File 'lib/taskpaper/document.rb', line 4 def doc @doc end |
#filename ⇒ Object
Returns the value of attribute filename.
4 5 6 |
# File 'lib/taskpaper/document.rb', line 4 def filename @filename end |
Instance Method Details
#inspect ⇒ Object
34 35 36 |
# File 'lib/taskpaper/document.rb', line 34 def inspect doc.map(&:inspect) end |
#parse ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/taskpaper/document.rb', line 6 def parse @doc = [] @text.each_line do |line| item = Taskpaper::Item.new line @doc << item.classify.new(line) end @doc end |
#to_html ⇒ Object
26 27 28 |
# File 'lib/taskpaper/document.rb', line 26 def to_html # TODO: to_html end |
#to_json ⇒ Object
30 31 32 |
# File 'lib/taskpaper/document.rb', line 30 def to_json # TODO: to_json end |
#to_text ⇒ Object
22 23 24 |
# File 'lib/taskpaper/document.rb', line 22 def to_text @text end |