Skip to content

Commit

Permalink
Set fake's __copied_class__ on class creation
Browse files Browse the repository at this point in the history
References #19
  • Loading branch information
psyho committed Jun 26, 2013
1 parent 5462362 commit e6e323a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/bogus/copies_classes.rb
Expand Up @@ -5,8 +5,11 @@ class CopiesClasses
takes :copies_methods

def copy(klass)
copy_class = Class.new(Bogus::Fake)
copy_class.__copied_class__ = klass
copy_class = Class.new(Bogus::Fake) do
define_singleton_method(:__copied_class__) do
klass
end
end
copies_methods.copy(klass, copy_class)
copy_class
end
Expand Down
2 changes: 0 additions & 2 deletions lib/bogus/fake.rb
Expand Up @@ -26,8 +26,6 @@ def instance_of?(klass)
end

class << self
attr_accessor :__copied_class__

alias :__create__ :new

def new(*args, &block)
Expand Down

0 comments on commit e6e323a

Please sign in to comment.