Module: GitDiff::Line::ClassMethods

Included in:
GitDiff::Line
Defined in:
lib/git_diff/line.rb

Instance Method Summary collapse

Instance Method Details

#from_string(string) ⇒ Object



10
11
12
# File 'lib/git_diff/line.rb', line 10

def from_string(string)
  line_class(string[0]).new(string)
end

#line_class(symbol) ⇒ Object



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

def line_class(symbol)
  line_classes[symbol] || Context
end

#line_classesObject



18
19
20
# File 'lib/git_diff/line.rb', line 18

def line_classes
  { "+" => Addition, "-" => Deletion }
end