Sha256: a3782406fa59f10c95e23d96f585860e0fbd429369cf66958dda681532d3e1ab
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
class Module # Standard in rails... See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Module.html] def alias_method_chain(target, feature) # Strip out punctuation on predicates or bang methods since # e.g. target?_without_feature is not a valid method name. aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1 yield(aliased_target, punctuation) if block_given? with_method, without_method = "#{aliased_target}_with_#{feature}#{punctuation}", "#{aliased_target}_without_#{feature}#{punctuation}" alias_method without_method, target alias_method target, with_method case when public_method_defined?(without_method) public target when protected_method_defined?(without_method) protected target when private_method_defined?(without_method) private target end end unless method_defined? :alias_method_chain # Can't use alias_method here because of jruby (see http://jira.codehaus.org/browse/JRUBY-2435 ) def module_exec(*arg, &block) instance_exec(*arg, &block) end unless method_defined? :module_exec alias_method :class_exec, :module_exec unless method_defined? :class_exec end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
marcandre-backports-1.7.0 | lib/backports/module.rb |
marcandre-backports-1.7.1 | lib/backports/module.rb |
backports-1.7.1 | lib/backports/module.rb |
backports-1.7.0 | lib/backports/module.rb |