Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/insert.rb

Instance Method Summary collapse

Instance Method Details

#alias_method_chain_arperf(methods) ⇒ Object

support deprecated method_x commands alias method to method_without_arperf_options alias method_x to method



6
7
8
9
10
11
12
13
14
15
# File 'lib/insert.rb', line 6

def alias_method_chain_arperf(methods)
  methods = Array.new(methods)
  methods.each do |target|
    unless method_defined?("#{target}_without_arperf_options")
      aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
      alias_method "#{aliased_target}_without_arperf_options#{punctuation}", target
      alias_method target, "#{aliased_target}_x#{punctuation}"
    end
  end
end