Class: FitCommit::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/fit-commit/line.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#linenoObject

Returns the value of attribute lineno.



4
5
6
# File 'lib/fit-commit/line.rb', line 4

def lineno
  @lineno
end

#textObject

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

Returns:

  • (Boolean)


14
15
16
# File 'lib/fit-commit/line.rb', line 14

def empty?
  text.empty?
end

#to_sObject



10
11
12
# File 'lib/fit-commit/line.rb', line 10

def to_s
  text
end