Module: RaaP::BindCall

Defined in:
lib/raap/bind_call.rb

Class Method Summary collapse

Class Method Details

.class(obj) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/raap/bind_call.rb', line 15

def class(obj)
  if instance_of?(obj, BasicObject)
    ::Kernel.instance_method(:class).bind_call(obj)
  else
    obj.class
  end
end

.define_methodObject



6
# File 'lib/raap/bind_call.rb', line 6

def define_method(...) = ::Module.instance_method(:define_method).bind_call(...)

.extendObject



10
# File 'lib/raap/bind_call.rb', line 10

def extend(...) = ::Kernel.instance_method(:extend).bind_call(...)

.inspect(obj) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/raap/bind_call.rb', line 23

def inspect(obj)
  if instance_of?(obj, BasicObject)
    ::Kernel.instance_method(:inspect).bind_call(obj)
  else
    case obj
    when Hash
      body = obj.map do |k, v|
        "#{inspect(k)} => #{inspect(v)}"
      end
      "{#{body.join(', ')}}"
    when Array
      "[#{obj.map { |o| inspect(o) }.join(', ')}]"
    else
      obj.inspect
    end
  end
rescue NoMethodError
  "#<#{self.class(obj)}>"
end

.instance_of?Boolean

Returns:

  • (Boolean)


8
# File 'lib/raap/bind_call.rb', line 8

def instance_of?(...) = ::Kernel.instance_method(:instance_of?).bind_call(...)

.is_a?Boolean

Returns:

  • (Boolean)


9
# File 'lib/raap/bind_call.rb', line 9

def is_a?(...) = ::Kernel.instance_method(:is_a?).bind_call(...)

.nameObject



11
# File 'lib/raap/bind_call.rb', line 11

def name(...) = ::Module.instance_method(:name).bind_call(...)

.public_sendObject



13
# File 'lib/raap/bind_call.rb', line 13

def public_send(...) = ::Kernel.instance_method(:public_send).bind_call(...)

.respond_to?Boolean

Returns:

  • (Boolean)


7
# File 'lib/raap/bind_call.rb', line 7

def respond_to?(...) = ::Kernel.instance_method(:respond_to?).bind_call(...)

.to_sObject



12
# File 'lib/raap/bind_call.rb', line 12

def to_s(...) = ::Kernel.instance_method(:to_s).bind_call(...)