Class: GitDiff::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/git_diff/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Parser

Returns a new instance of Parser.



7
8
9
10
# File 'lib/git_diff/parser.rb', line 7

def initialize(string)
  @string = string
  @diff = Diff.new
end

Instance Attribute Details

#diffObject (readonly)

Returns the value of attribute diff.



5
6
7
# File 'lib/git_diff/parser.rb', line 5

def diff
  @diff
end

#stringObject (readonly)

Returns the value of attribute string.



5
6
7
# File 'lib/git_diff/parser.rb', line 5

def string
  @string
end

Instance Method Details

#parseObject



12
13
14
15
16
# File 'lib/git_diff/parser.rb', line 12

def parse
  lines.each do |line|
    diff << line
  end
end