Sha256: 3a32dca53fffab4fdbc77546c2c0b4fecf42368874985b13830adb36e01bb1ab

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

require 'forwardable'
require 'eigenclass/version'

# Provides access to an object's {eigenclass} and defines
# some convenient helper methods to interact with it.
module Eigenclass
  extend Forwardable

  def_delegator :eigenclass, :attr_accessor, :eattr_accessor
  def_delegator :eigenclass, :attr_reader, :eattr_reader
  def_delegator :eigenclass, :attr_writer, :eattr_writer
  def_delegator :eigenclass, :define_method, :edefine_method
  def_delegator :eigenclass, :instance_eval, :eigenclass_eval
  def_delegator :eigenclass, :instance_exec, :eigenclass_exec

  # Alias of {Object#singleton_class}
  # @see http://ruby-doc.org/core-1.9.2/Object.html#method-i-singleton_class
  def eigenclass
    class << self
      self
    end
  end
end

Object.send(:include, Eigenclass)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eigenclass-2.0.2 lib/eigenclass.rb