mongoid / origin

A Ruby DSL for building MongoDB queries
http://mongoid.org/en/origin/index.html
MIT License
62 stars 29 forks source link

Add __FILE__, __LINE__ to the class-, module_eval calls #105

Open Shamaoke opened 9 years ago

Shamaoke commented 9 years ago

Please, add the __FILE__ and __LINE__ constants as the 2nd and 3rd arguments to the class- and module_eval calls in Origin::Forwardable#__forward__ to impove the debugging process.

require 'mongoid'

class Person
  include Mongoid::Document
end

# without __FILE__, __LINE__
Person.method(:where).source_location #=> ["(eval)", 1]

# with __FILE__, __LINE__
Person.method(:where).source_location
#=> ["/home/user/<...>/origin-2.1.1/lib/origin/forwardable.rb", 47]
arthurnn commented 9 years ago

@Shamaoke fell free to send a PR with those changes.. thanks