Class: FitCommit::Line
- Inherits:
-
Object
- Object
- FitCommit::Line
- Defined in:
- lib/fit-commit/line.rb
Instance Attribute Summary collapse
-
#lineno ⇒ Object
Returns the value of attribute lineno.
-
#text ⇒ Object
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(lineno, text) ⇒ Line
constructor
A new instance of Line.
- #to_s ⇒ Object
Constructor Details
#initialize(lineno, text) ⇒ Line
Returns a new instance of Line.
5 6 7 8 |
# File 'lib/fit-commit/line.rb', line 5 def initialize(lineno, text) self.lineno = lineno self.text = text end |
Instance Attribute Details
#lineno ⇒ Object
Returns the value of attribute lineno.
4 5 6 |
# File 'lib/fit-commit/line.rb', line 4 def lineno @lineno end |
#text ⇒ Object
Returns the value of attribute text.
4 5 6 |
# File 'lib/fit-commit/line.rb', line 4 def text @text end |
Class Method Details
.from_array(text_array) ⇒ Object
18 19 20 |
# File 'lib/fit-commit/line.rb', line 18 def self.from_array(text_array) text_array.map.with_index(1) { |text, lineno| new(lineno, text) } end |
Instance Method Details
#empty? ⇒ Boolean
14 15 16 |
# File 'lib/fit-commit/line.rb', line 14 def empty? text.empty? end |
#to_s ⇒ Object
10 11 12 |
# File 'lib/fit-commit/line.rb', line 10 def to_s text end |