Sha256: cae4da862ea83f2a780eb1cab115cefc8fb2426ec387d5c0d9440044dd9cd874

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

class Object

  # Access to an object's special singleton class.
  #
  #   require 'facet/object/special_class'
  #
  def special_class
    (class << self; self; end)
  end

  # Alias for #special_class.
  #
  #   require 'facet/object/special_class'
  #
  alias_method :singleton_class, :special_class

  # Special singleton class eval.
  #
  #   require 'facet/object/special_class'
  #
  def special_class_eval(&block)
    special_class.class_eval(&block)
  end

  # Alias for #special_class_eval.
  #
  #   require 'facet/object/special_class'
  #
  alias_method :singleton_class_eval, :special_class_eval

  # Special singleton class define method.
  #
  #   require 'facet/object/special_class'
  #
  def define_special_method(meth, &block)
    special_class_eval{ define_method(meth, &block) }
  end
  
  # Alias for #define_special_method.
  #
  #   require 'facet/object/special_class'
  #
  alias_method :define_singleton_method, :define_special_method
  
end 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.6.3 lib/facet/object/special_class.rb