class Bogus::CopiesConstructor

Public Instance Methods

body(initializer) click to toggle source
# File lib/bogus/fakes/constructor_methods.rb, line 13
def body(initializer)
  body = method_stringifier.stringify(initializer, "super")
  body.gsub("initialize", "new")
end
copy(from, into) click to toggle source
# File lib/bogus/fakes/constructor_methods.rb, line 6
def copy(from, into)
  return unless from.is_a?(Class)
  initializer = instance_methods.call(from).get(:initialize)
  body = body(initializer)
  class_methods.call(into).define(body)
end