$ irb
r = [1…99, 100…199]
=> [1…99, 100…199]
xs = r.local_methods
=> [:, :, :, :-, :, :=>, :[], :[], :all?, :any?, :assoc, :at, :clear,
:collect, :collect!, :combination, :compact, :compact!, :concat, :count,
:cycle, :delete, :delete_at, :delete_if, :detect, :drop, :drop_while,
:each, :each_cons, :each_index, :each_slice, :each_with_index,
:each_with_object, :empty?, :entries, :fetch, :fill, :find, :find_all,
:find_index, :first, :flatten, :flatten!, :fold, :grep, :group_by,
:include?, :index, :inject, :insert, :join, :last, :length, :map, :map!,
:max, :max_by, :member?, :min, :min_by, :minmax, :minmax_by, :none?,
:one?, :pack, :partition, :permutation, :pop, :product, :push, :rassoc,
:reduce, :reject, :reject!, :replace, :reverse, :reverse!,
:reverse_each, :rindex, :sample, :select, :shift, :shuffle, :shuffle!,
:size, :slice, :slice!, :sort, :sort!, :sort_by, :take, :take_while,
:to_a, :to_ary, :transpose, :uniq, :uniq!, :unshift, :values_at, :zip,
:]
load ‘extensions/Array.rb’
=> true
r.local_methods - xs
=> [:rand]
This is extensions/Array.rb
class Array
def index_in_range( n )
self.each_with_index do |x, i|
return i if x === n
end
return nil
end
end
It did have a rand function in there, but I removed it because it was
being loaded but the index_in_range wasn’t. I’ve no idea how the rand
function is still getting added if it’s not defined in the file.
Any help is more than appreciated, it’s needed for my continued sanity
(which was already at question)
Regards,
Iain