Class: GTDThing
- Inherits:
-
Object
- Object
- GTDThing
- Defined in:
- lib/gtdlint.rb
Overview
Parse, model, and print a line too wide for its own good
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#line ⇒ Object
Returns the value of attribute line.
-
#line_number ⇒ Object
Returns the value of attribute line_number.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename, line_number, line) ⇒ GTDThing
constructor
A new instance of GTDThing.
- #to_s ⇒ Object
Constructor Details
#initialize(filename, line_number, line) ⇒ GTDThing
Returns a new instance of GTDThing.
84 85 86 87 88 |
# File 'lib/gtdlint.rb', line 84 def initialize(filename, line_number, line) @filename = filename @line_number = line_number @line = line end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
69 70 71 |
# File 'lib/gtdlint.rb', line 69 def filename @filename end |
#line ⇒ Object
Returns the value of attribute line.
69 70 71 |
# File 'lib/gtdlint.rb', line 69 def line @line end |
#line_number ⇒ Object
Returns the value of attribute line_number.
69 70 71 |
# File 'lib/gtdlint.rb', line 69 def line_number @line_number end |
Class Method Details
.parse(filename, grep_line) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/gtdlint.rb', line 71 def self.parse(filename, grep_line) if grep_line.match(/^--$/) grep_line else match = grep_line.match(/^([0-9]+)(\:|-)(.*)$/) line_number = match[1] line = match[3] GTDThing.new(filename, line_number, line) end end |
Instance Method Details
#to_s ⇒ Object
90 91 92 |
# File 'lib/gtdlint.rb', line 90 def to_s "#{filename}:#{line_number}:#{line}" end |