Class: ConvenientService::Utils::Object::GetOwnMethod

Inherits:
Support::Command show all
Defined in:
lib/convenient_service/utils/object/get_own_method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(object, method_name, private: false) ⇒ GetOwnMethod

Returns a new instance of GetOwnMethod.

Parameters:

  • object (Object)

    Can be any type.

  • method_name (Symbol, String)
  • private (Boolean) (defaults to: false)


35
36
37
38
39
# File 'lib/convenient_service/utils/object/get_own_method.rb', line 35

def initialize(object, method_name, private: false)
  @object = object
  @method_name = method_name
  @private = private
end

Instance Attribute Details

#method_nameObject (readonly)

Returns the value of attribute method_name.



22
23
24
# File 'lib/convenient_service/utils/object/get_own_method.rb', line 22

def method_name
  @method_name
end

#objectObject (readonly)

Returns the value of attribute object.



16
17
18
# File 'lib/convenient_service/utils/object/get_own_method.rb', line 16

def object
  @object
end

#privateObject (readonly)

Returns the value of attribute private.



28
29
30
# File 'lib/convenient_service/utils/object/get_own_method.rb', line 28

def private
  @private
end

Instance Method Details

#callClass

Returns:



49
50
51
52
53
54
55
# File 'lib/convenient_service/utils/object/get_own_method.rb', line 49

def call
  own_method = Utils::Module.get_own_instance_method(object.class, method_name, private: private)

  return unless own_method

  own_method.bind(object)
end