Class: Hanami::Utils::BasicObject

Inherits:
BasicObject
Defined in:
lib/hanami/utils/basic_object.rb

Overview

BasicObject

Since:

  • 0.3.5

Direct Known Subclasses

Interactor::Result

Instance Method Summary collapse

Instance Method Details

#classObject

Return the class for debugging purposes.



12
13
14
# File 'lib/hanami/utils/basic_object.rb', line 12

def class
  (class << self; self; end).superclass
end

#inspectString

Bare minimum inspect for debugging purposes.

Returns:

  • (String)

    the inspect string

See Also:

Since:

  • 0.3.5



23
24
25
# File 'lib/hanami/utils/basic_object.rb', line 23

def inspect
  "#<#{self.class}:#{'%x' % (__id__ << 1)}#{__inspect}>" # rubocop:disable Style/FormatString
end

#object_idFixnum

Alias for __id__

Returns:

  • (Fixnum)

    the object id

See Also:

Since:

  • 0.9.0



34
35
36
# File 'lib/hanami/utils/basic_object.rb', line 34

def object_id
  __id__
end

#pretty_printString

Interface for pp

Returns:

  • (String)

    the pretty-printable inspection of the object

See Also:

Since:

  • 0.9.0



45
46
47
# File 'lib/hanami/utils/basic_object.rb', line 45

def pretty_print(*)
  inspect
end

#respond_to?(method_name, include_all = false) ⇒ TrueClass, FalseClass

Returns true if responds to the given method.

Returns:

  • (TrueClass, FalseClass)

    the result of the check

See Also:

Since:

  • 0.3.5



56
57
58
# File 'lib/hanami/utils/basic_object.rb', line 56

def respond_to?(method_name, include_all = false)
  respond_to_missing?(method_name, include_all)
end