Class: ObjectForge::UnBasicObject Private

Inherits:
BasicObject
Defined in:
lib/object_forge/un_basic_object.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

BasicObject with a few common methods copied from Object.

Since:

  • 0.1.0

Direct Known Subclasses

Crucible, ForgeDSL

Instance methods copied from Object collapse

Instance Method Summary collapse

Instance Method Details

#classClass

See Also:

  • Kernel#class


37
38
39
# File 'lib/object_forge/un_basic_object.rb', line 37

i[class eql? freeze frozen? hash inspect is_a? respond_to? to_s].each do |m|
  define_method(m, ::Object.instance_method(m))
end

#eql?(other) ⇒ Boolean

See Also:

  • Object#eql?


37
38
39
# File 'lib/object_forge/un_basic_object.rb', line 37

i[class eql? freeze frozen? hash inspect is_a? respond_to? to_s].each do |m|
  define_method(m, ::Object.instance_method(m))
end

#freezeself

See Also:

  • Kernel#freeze


37
38
39
# File 'lib/object_forge/un_basic_object.rb', line 37

i[class eql? freeze frozen? hash inspect is_a? respond_to? to_s].each do |m|
  define_method(m, ::Object.instance_method(m))
end

#frozen?Boolean

See Also:

  • Kernel#frozen?


37
38
39
# File 'lib/object_forge/un_basic_object.rb', line 37

i[class eql? freeze frozen? hash inspect is_a? respond_to? to_s].each do |m|
  define_method(m, ::Object.instance_method(m))
end

#hashInteger

See Also:

  • Object#hash


37
38
39
# File 'lib/object_forge/un_basic_object.rb', line 37

i[class eql? freeze frozen? hash inspect is_a? respond_to? to_s].each do |m|
  define_method(m, ::Object.instance_method(m))
end

#inspectString

See Also:

  • Object#inspect


37
38
39
# File 'lib/object_forge/un_basic_object.rb', line 37

i[class eql? freeze frozen? hash inspect is_a? respond_to? to_s].each do |m|
  define_method(m, ::Object.instance_method(m))
end

#is_a?Boolean Also known as: kind_of?

See Also:

  • Kernel#is_a?


37
38
39
# File 'lib/object_forge/un_basic_object.rb', line 37

i[class eql? freeze frozen? hash inspect is_a? respond_to? to_s].each do |m|
  define_method(m, ::Object.instance_method(m))
end

#pretty_printObject

Note:

This method dynamically calls UnboundMethod#bind_call, making it fairly slow.

Support for pp (and IRB).

Since:

  • 0.1.0



51
52
53
54
55
# File 'lib/object_forge/un_basic_object.rb', line 51

def pretty_print(...)
  # We have to do it this way, instead of defining methods,
  # because Object#pretty_print does not exist without requiring "pp".
  ::Object.instance_method(:pretty_print).bind_call(self, ...)
end

#pretty_print_cycleObject

Note:

This method dynamically calls UnboundMethod#bind_call, making it fairly slow.

Support for pp (and IRB).

Since:

  • 0.1.0



58
59
60
61
62
63
# File 'lib/object_forge/un_basic_object.rb', line 58

def pretty_print_cycle(...)
  # See comment for #pretty_print.
  # :nocov:
  ::Object.instance_method(:pretty_print_cycle).bind_call(self, ...)
  # :nocov:
end

#respond_to?(symbol[, include_private]) ⇒ Boolean

See Also:

  • Object#respond_to?


37
38
39
# File 'lib/object_forge/un_basic_object.rb', line 37

i[class eql? freeze frozen? hash inspect is_a? respond_to? to_s].each do |m|
  define_method(m, ::Object.instance_method(m))
end

#to_sString

See Also:

  • Object#to_s


37
38
39
# File 'lib/object_forge/un_basic_object.rb', line 37

i[class eql? freeze frozen? hash inspect is_a? respond_to? to_s].each do |m|
  define_method(m, ::Object.instance_method(m))
end