Class: Bogus::CopiesClasses
- Inherits:
-
Object
- Object
- Bogus::CopiesClasses
- Extended by:
- Takes
- Defined in:
- lib/bogus/fakes/copies_classes.rb
Instance Method Summary collapse
Methods included from Takes
Instance Method Details
#copy(klass) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bogus/fakes/copies_classes.rb', line 7 def copy(klass) copy_class = Class.new(Bogus::Fake) do define_singleton_method(:__copied_class__) do klass end define_singleton_method(:name) do klass.name end define_singleton_method(:to_s) do klass.name end define_singleton_method(:const_missing) do |name| klass.const_get(name) end end copies_methods.copy(klass, copy_class) copy_class end |