Sha256: 7bb6da22d93ad3d79e1492817aad4d33fff0b3f951beaea530a40e460d3a3165
Contents?: true
Size: 609 Bytes
Versions: 1
Compression:
Stored size: 609 Bytes
Contents
class Module refine_orig = "__refine_orig_#{Time.now.to_i}".to_sym methods = instance_methods(false) + private_instance_methods(false) if methods.include?(:refine) if methods.include?(refine_orig) raise LoadError, "can't re-define Module#refine" end alias_method refine_orig, :refine remove_method :refine end def refine(klass, &blk) klass.class_eval(&blk) end begin require 'pattern-match' ensure remove_method :refine if Kernel.respond_to?(refine_orig, true) alias_method :refine, refine_orig remove_method refine_orig end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pattern-match-1.0.1 | lib/pattern-match/disable_refinements.rb |