Skip to content

Commit

Permalink
Converting CodeChange into a real class to aid recursive changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsanderson committed May 27, 2008
1 parent ce422ce commit 139ca87
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/code_comparison.rb
@@ -1,11 +1,19 @@
class CodeChange < Struct.new(:signature, :operation)
class CodeChange
attr_reader :signature
attr_reader :operation

OPERATION_CHARS = {
:added => "+",
:removed => "-",
:changed => "c",
:moved => "m" #Not used yet
}

def initialize(signature, operation)
@signature = signature
@operation = operation
end

def to_s
"#{OPERATION_CHARS[self.operation]} #{signature}"
end
Expand Down Expand Up @@ -52,4 +60,4 @@ def removal(sig, sexp)
def changed(old_sig, old_sexp, new_sig, new_sexp)
CodeChange.new(old_sig, :changed)
end
end
end

0 comments on commit 139ca87

Please sign in to comment.