Sha256: 84721b1b5fd30a2a09eb3199c3ed9e67e1e021c8d3a9736d3c4ab1c1dae4a9e6
Contents?: true
Size: 1.41 KB
Versions: 11
Compression:
Stored size: 1.41 KB
Contents
module MPatch class << self def inject_patches #begin # @@valid_inject_cmd.nil? #rescue ::NameError # return nil #end self.submodules.each do |module_name| method_name= module_name.to_s.split('::').last.downcase.to_s.to_sym module_name.__send__ :extend, MPatch::Include::Module module_name.submodules.each do |sub_module_name| constant= ::Object constant_name= sub_module_name.to_s.split('::').last array_of_target_constant= [] case true when sub_module_name.to_s.include?('And') sub_module_name.to_s.split('::').last.split('And').each do |tag_module| array_of_target_constant.push tag_module end else array_of_target_constant.push constant_name end array_of_target_constant.each do |name| begin target_constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name) target_constant.__send__ method_name, sub_module_name rescue ::NoMethodError => ex STDERR.puts ex end end end end end alias :inject :inject_patches alias :patch! :inject_patches end require File.join 'mpatch','module' extend MPatch::Include::Module #@@valid_inject_cmd= true end
Version data entries
11 entries across 11 versions & 1 rubygems