Class: ToDo
- Inherits:
-
Object
- Object
- ToDo
- Defined in:
- lib/drupal/todo_list.rb
Overview
TODO: example.
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#linenumber ⇒ Object
Returns the value of attribute linenumber.
-
#summary ⇒ Object
Returns the value of attribute summary.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(linenumber, summary, context) ⇒ ToDo
constructor
A new instance of ToDo.
- #to_s ⇒ Object
Constructor Details
#initialize(linenumber, summary, context) ⇒ ToDo
Returns a new instance of ToDo.
51 52 53 54 55 |
# File 'lib/drupal/todo_list.rb', line 51 def initialize (linenumber, summary, context) @linenumber = linenumber @summary = summary @context = context end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
49 50 51 |
# File 'lib/drupal/todo_list.rb', line 49 def context @context end |
#linenumber ⇒ Object
Returns the value of attribute linenumber.
49 50 51 |
# File 'lib/drupal/todo_list.rb', line 49 def linenumber @linenumber end |
#summary ⇒ Object
Returns the value of attribute summary.
49 50 51 |
# File 'lib/drupal/todo_list.rb', line 49 def summary @summary end |
Class Method Details
.extract_context(linenumber, file) ⇒ Object
66 67 68 69 70 71 |
# File 'lib/drupal/todo_list.rb', line 66 def ToDo.extract_context(linenumber, file) file.rewind list = file.to_a #rewind one line (one line above) then add the line itself and three lines below. list.slice!(linenumber - 1, 5) end |
.extract_summary(line) ⇒ Object
61 62 63 64 |
# File 'lib/drupal/todo_list.rb', line 61 def ToDo.extract_summary(line) matches = line.match /(?:#|\/\/|\/\*|@)[\s]*todo:?[\s]*(.+)$/i matches[1] unless matches.nil? || matches.length <= 0 end |
Instance Method Details
#to_s ⇒ Object
57 58 59 |
# File 'lib/drupal/todo_list.rb', line 57 def to_s "#{@linenumber}: #{@summary}\n#{@context}\n" end |