Sha256: 75e4cd3655cf9911794eed299bfd0e3a5cc07a2bc64f2adbdd083f43c8295e79
Contents?: true
Size: 723 Bytes
Versions: 13
Compression:
Stored size: 723 Bytes
Contents
# *Correct* `alias_method_chain_once` implementation class Module def alias_method_chain_once(target, feature) aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1 without_method = "#{aliased_target}_without_#{feature}#{punctuation}" # `method_defined?` matches public and protected methods, # also `*_method_defined?` family of methods is the portable # way to check for method existence, while `public_methods.include?` # will work either on 1.8 or 1.9 (depending on where symbol or string # is provided as method name) unless method_defined?(without_method) || private_method_defined?(without_method) alias_method_chain(target, feature) end end end
Version data entries
13 entries across 13 versions & 1 rubygems