Module: NREPL::DefinitionFixer

Defined in:
lib/nrepl/server.rb

Constant Summary collapse

@@definitions =
{}

Instance Method Summary collapse

Instance Method Details

#__lazuli_source_location(method) ⇒ Object



116
117
118
119
120
121
122
# File 'lib/nrepl/server.rb', line 116

def __lazuli_source_location(method)
  ancestors.each do |klass|
    loc = (klass.instance_variable_get(:@__lazuli_methods) || {})[method]
    return loc if loc
  end
  return instance_method(method).source_location
end

#method_added(method_name) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/nrepl/server.rb', line 124

def method_added(method_name)
  return if method_name == :__lazuli_source_location
  # puts "Thing added #{method_name}"
  path = caller.reject { |x| x =~ /gems.*gems/ }[0]
  if path
    (file, row) = path.split(/:/)

    known = instance_variable_get(:@__lazuli_methods)
    if !known
      known = {}
      instance_variable_set(:@__lazuli_methods, known)
    end
    known[method_name] = [file, row.to_i]
  end
end