Module: ActiveReload::ProcInspector

Defined in:
lib/active_reload.rb

Overview

Railtie

Instance Method Summary collapse

Instance Method Details

#source?(file) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/active_reload.rb', line 26

def source?(file)
  source_file.match( Regexp.new(file) )
end

#source_fileObject

Proc#source_location is not available in Ruby 1.8



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

def source_file
  # Extract from format like this: "#<Proc:0xb750a994@/home/rupert/.rvm/gems/ruby-1.8.7-p174/gems/activerecord-3.0.9/lib/active_record/railtie.rb:74>"
  to_s.match(/.*@(.*):[0-9]+>/)[1]
end