class Dry::Core::BasicObject

BasicObject

@since 0.8.0

Public Class Methods

const_missing(name) click to toggle source

Lookups constants at the top-level namespace, if they are missing in the current context.

@param name [Symbol] the constant name

@return [Object, Module] the constant

@raise [NameError] if the constant cannot be found

@since 0.8.0 @api private

@see ruby-doc.org/core/Module.html#method-i-const_missing

# File lib/dry/core/basic_object.rb, line 23
def self.const_missing(name)
  ::Object.const_get(name)
end

Public Instance Methods

class() click to toggle source

Returns the class for debugging purposes.

@since 0.8.0

@see ruby-doc.org/core/Object.html#method-i-class

# File lib/dry/core/basic_object.rb, line 32
def class
  (class << self; self; end).superclass
end
object_id() click to toggle source

Alias for __id__

@return [Fixnum] the object id

@since 0.8.0

@see ruby-doc.org/core/Object.html#method-i-object_id

# File lib/dry/core/basic_object.rb, line 101
def object_id
  __id__
end
pretty_print(printer) click to toggle source

Interface for pp

@param printer [PP] the Pretty Printable printer @return [String] the pretty-printable inspection of the object

@since 0.8.0

@see ruby-doc.org/stdlib/libdoc/pp/rdoc/PP.html

# File lib/dry/core/basic_object.rb, line 113
def pretty_print(printer)
  printer.text(inspect)
end
respond_to?(method_name, include_all = false) click to toggle source

Returns true if responds to the given method.

@return [TrueClass,FalseClass] the result of the check

@since 0.8.0

@see ruby-doc.org/core/Object.html#method-i-respond_to-3F

# File lib/dry/core/basic_object.rb, line 124
def respond_to?(method_name, include_all = false) # rubocop:disable Style/OptionalBooleanParameter
  respond_to_missing?(method_name, include_all)
end

Private Instance Methods

__inspect() click to toggle source

@since 0.8.0 @api private

# File lib/dry/core/basic_object.rb, line 140
def __inspect # rubocop:disable Style/EmptyMethod
end
respond_to_missing?(_method_name, _include_all) click to toggle source

Must be overridden by descendants

@since 0.8.0 @api private

# File lib/dry/core/basic_object.rb, line 134
def respond_to_missing?(_method_name, _include_all)
  ::Kernel.raise ::NotImplementedError
end