Sha256: b13f4ce233a7b55ef62137bcc0a256b40cb6b2b5dacc7f5371bfa1b71200b3fd

Contents?: true

Size: 696 Bytes

Versions: 16

Compression:

Stored size: 696 Bytes

Contents

class BasicObject #:nodoc:
  instance_methods.each { |m| undef_method m unless m =~ /(^__|^nil\?$|^send$|instance_eval|proxy_|^object_id$)/ }
end unless defined?(BasicObject)

class Boolean
  def self.mm_typecast(value)
    ['true', 't', '1'].include?(value.to_s.downcase)
  end
end

class Object
  # 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

Version data entries

16 entries across 16 versions & 6 rubygems

Version Path
crnixon-mongomapper-0.3.4 lib/mongomapper/support.rb
djsun-mongomapper-0.3.3 lib/mongomapper/support.rb
djsun-mongomapper-0.3.5.1 lib/mongomapper/support.rb
djsun-mongomapper-0.3.5.2 lib/mongomapper/support.rb
djsun-mongomapper-0.3.5.4 lib/mongomapper/support.rb
djsun-mongomapper-0.3.5.5 lib/mongomapper/support.rb
djsun-mongomapper-0.3.5 lib/mongomapper/support.rb
hashrocket-mongomapper-0.3.3 lib/mongomapper/support.rb
hashrocket-mongomapper-0.3.4.1 lib/mongomapper/support.rb
hashrocket-mongomapper-0.3.4 lib/mongomapper/support.rb
hashrocket-mongomapper-0.3.5 lib/mongomapper/support.rb
jnunemaker-mongomapper-0.3.3 lib/mongomapper/support.rb
jnunemaker-mongomapper-0.3.4 lib/mongomapper/support.rb
jnunemaker-mongomapper-0.3.5 lib/mongomapper/support.rb
nirvdrum-mongomapper-0.3.3 lib/mongomapper/support.rb
shingara-mongomapper-0.3.3 lib/mongomapper/support.rb