Sha256: 923134faeb31aa581f7d306cce5e07e33a26330d61a26827b325770c308c2ee7

Contents?: true

Size: 330 Bytes

Versions: 3

Compression:

Stored size: 330 Bytes

Contents

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

  # class_eval on an object acts like singleton_class.class_eval.
  def class_eval(*args, &block)
    singleton_class.class_eval(*args, &block)
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
memoist-0.2.0 lib/memoist/core_ext/singleton_class.rb
memoist-0.1.0 lib/memoist/core_ext/singleton_class.rb
cassandra_mapper-0.0.1 lib/cassandra_mapper/core_ext/kernel/singleton_class.rb