Sha256: e72f533d3fa0f97286400dbdb1149b3be15470fbb306e97d85165dd56de509fb
Contents?: true
Size: 739 Bytes
Versions: 3
Compression:
Stored size: 739 Bytes
Contents
module Bogus class CopiesMethods extend Bogus::Takes takes :makes_substitute_methods, :instance_methods, :class_methods def copy(from, into) copy_methods(from, into, instance_methods) copy_methods(from, into, class_methods) end private def copy_methods(original_class, copy_class, make_methods) original_methods = make_methods.call(original_class) copy_methods = make_methods.call(copy_class) original_methods.all.each do |name| method = original_methods.get(name) body = method_as_string(method) copy_methods.define(body) end end def method_as_string(method) makes_substitute_methods.stringify(method) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bogus-0.0.4 | lib/bogus/copies_methods.rb |
bogus-0.0.3 | lib/bogus/copies_methods.rb |
bogus-0.0.3.rc.2 | lib/bogus/copies_methods.rb |