Skip to content

Commit

Permalink
Mimic BasicObject without using BasicObject
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaclayton committed Jan 8, 2012
1 parent b734b58 commit d9e0372
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/factory_girl/attribute_assigner.rb
@@ -1,3 +1,5 @@
require "active_support/basic_object"

module FactoryGirl
class AttributeAssigner
def initialize(build_class, evaluator, attribute_list)
Expand Down Expand Up @@ -33,7 +35,11 @@ def build_class_instance
end

def null_object
Class.new(BasicObject) do
Class.new do
instance_methods.each do |m|
undef_method(m) if m.to_s !~ /(?:^__|^nil\?$|^send$|^object_id$)/
end

def method_missing(*args)
nil
end
Expand Down

0 comments on commit d9e0372

Please sign in to comment.