Module: Hammock::ModulePatches::InstanceMethods

Defined in:
lib/hammock/monkey_patches/module.rb

Instance Method Summary collapse

Instance Method Details

#alias_method_chain_once(target, feature) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/hammock/monkey_patches/module.rb', line 15

def alias_method_chain_once target, feature
  aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
  without_method = "#{aliased_target}_without_#{feature}#{punctuation}"

  unless [public_instance_methods, protected_instance_methods, private_instance_methods].flatten.include? without_method
    alias_method_chain target, feature
  end
end