Sha256: abcdf1acc282eeccb73711f3e8180d2bc9f88257e61712288a4f1dd2a03b2ca6

Contents?: true

Size: 734 Bytes

Versions: 6

Compression:

Stored size: 734 Bytes

Contents

module Kernel

  # Kernel extension prefixed by instance_ which provide
  # internal (eg private) access to the object.
  # Kernel extension using instance_ prefix which is beneficial
  # to separation of metaprogramming from general programming.
  # object_ methods, in contrast to the instance_ methods,
  # do not access internal state.

  # Easy access to an object qua class, otherwise known
  # as the object's metaclass or singleton class. This
  # implemnetation alwasy returns the class, even if a
  # block is provided to eval against it.
  #
  #     It is what it is.
  #
  #  CREDIT: Trans

  def instance_class(&block)
    (class << self; self; end).module_eval(&block) if block
    (class << self; self; end)
  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
facets-2.4.1 lib/facets/kernel/instance_class.rb
facets-2.4.4 lib/core/facets/kernel/instance_class.rb
facets-2.4.2 lib/core/facets/kernel/instance_class.rb
facets-2.4.3 lib/core/facets/kernel/instance_class.rb
facets-2.4.5 lib/core/facets/kernel/instance_class.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_class.rb