Skip to content
Browse files

Let Ruby report the correct line numbers.

  • Loading branch information...
1 parent c2bf1a1 commit 6d98cc514fd8c6728f5ea98b711d5b435d5f5faf @splattael splattael committed Aug 22, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/equivalence.rb
View
6 lib/equivalence.rb
@@ -20,7 +20,7 @@ def __define_equivalence_hash_method(ivar_or_method_names)
name.start_with?('@') ? name : "self.#{name}"
end
- class_eval <<-EVAL, __FILE__, __LINE__
+ class_eval <<-EVAL, __FILE__, __LINE__ + 1
def hash
[#{ivar_or_method_names.join(', ')}].hash
end
@@ -30,7 +30,7 @@ def hash
def __define_equivalence_attribute_readers(method_names)
method_names.each do |method|
unless method_defined?(method)
- class_eval <<-EVAL, __FILE__, __LINE__
+ class_eval <<-EVAL, __FILE__, __LINE__ + 1
attr_reader :#{method} unless private_method_defined?(:#{method})
protected :#{method}
EVAL
@@ -39,7 +39,7 @@ def __define_equivalence_attribute_readers(method_names)
end
def __define_equivalence_equality_methods(method_names)
- class_eval <<-EVAL, __FILE__, __LINE__
+ class_eval <<-EVAL, __FILE__, __LINE__ + 1
def eql?(other)
self.class == other.class &&
#{method_names.map {|m| "self.#{m} == other.#{m}"}.join(" &&\n")}

0 comments on commit 6d98cc5

Please sign in to comment.
Something went wrong with that request. Please try again.