Skip to content

Commit

Permalink
Use Forwardable in Git::Line
Browse files Browse the repository at this point in the history
  • Loading branch information
mmozuras committed Sep 10, 2014
1 parent 6a7c001 commit ed3688b
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions lib/pronto/git/line.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
require 'forwardable'

module Pronto
module Git
class Line < Struct.new(:line, :patch, :hunk)
def addition?
line.addition?
end

def deletion?
line.deletion?
end

def content
line.content
end
extend Forwardable

def new_lineno
line.new_lineno
end

def old_lineno
line.old_lineno
end

def line_origin
line.line_origin
end
def_delegators :line, :addition?, :deletion?, :content, :new_lineno,
:old_lineno, :line_origin

def position
hunk_index = patch.hunks.find_index { |h| h.header == hunk.header }
Expand Down Expand Up @@ -52,7 +35,7 @@ def commit_line
end

def ==(other)
line.content == other.content &&
content == other.content &&
line_origin == other.line_origin &&
old_lineno == other.old_lineno &&
new_lineno == other.new_lineno
Expand Down

0 comments on commit ed3688b

Please sign in to comment.