Class: RBS::UnitTest::Convertibles::BlankSlate

Inherits:
BasicObject
Defined in:
sig/unit_test/convertibles.rbs,
lib/rbs/unit_test/convertibles.rb

Overview

An object that doesn't have methods excepts __send__ and __id__

Other methods are undefed.

Direct Known Subclasses

CustomRange, Each, ToA, ToArray, ToC, ToF, ToHash, ToI, ToIO, ToInt, ToPath, ToR, ToS, ToStr, ToSym

Instance Method Summary collapse

Instance Method Details

#__with_object_methods(*methods) ⇒ self

Add Object methods to self

Parameters:

  • methods (Symbol)

Returns:

  • (self)


11
12
13
14
15
16
17
18
19
# File 'sig/unit_test/convertibles.rbs', line 11

def __with_object_methods(*methods)
  methods.each do |method|
    singleton_class = ::Object.instance_method(:singleton_class).bind_call(self) #: Class
    singleton_class.instance_eval do
      define_method method, ::Object.instance_method(method)
    end
  end
  self
end