Skip to content

Commit

Permalink
Removing why's metaid object stuff and switching to new standards tha…
Browse files Browse the repository at this point in the history
…t are in 1.9.2 and active support 3.
  • Loading branch information
jnunemaker committed Jun 15, 2010
1 parent 6d07baf commit 0722b16
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
3 changes: 2 additions & 1 deletion UPGRADES
Expand Up @@ -3,4 +3,5 @@
* @new instance variable renamed to @_new (you shouldn't be using this anyway)
* Removed undefining of object_id in proxies and equal? method in Equality. This means checking equal? for a proxy and a regular document will always be false even if proxy refers to same document. Check Proxy#target instead. (ie: root.equal?(item.root.target))
* find no longer takes options as a last argument. It only works with id, multiple ids, array of ids.
* MongoMapper::MongoMapperError is now MongoMapper::Error
* MongoMapper::MongoMapperError is now MongoMapper::Error
* metaclass, meta_eval, meta_def, class_def removed as they were not being used
8 changes: 8 additions & 0 deletions lib/mongo_mapper/extensions/kernel.rb
@@ -0,0 +1,8 @@
module Kernel
# Returns the object's singleton class.
def singleton_class
class << self
self
end
end unless respond_to?(:singleton_class) # exists in 1.9.2
end
19 changes: 0 additions & 19 deletions lib/mongo_mapper/extensions/object.rb
Expand Up @@ -16,25 +16,6 @@ module InstanceMethods
def to_mongo
self.class.to_mongo(self)
end

# The hidden singleton lurks behind everyone
def metaclass
class << self; self end
end

def meta_eval(&blk)
metaclass.instance_eval(&blk)
end

# Adds methods to a metaclass
def meta_def(name, &blk)
meta_eval { define_method(name, &blk) }
end

# Defines an instance method within a class
def class_def(name, &blk)
class_eval { define_method(name, &blk) }
end
end
end
end
Expand Down

0 comments on commit 0722b16

Please sign in to comment.