Class: ConvenientService::Utils::Module::InstanceMethodDefined

Inherits:
Support::Command
  • Object
show all
Defined in:
lib/convenient_service/utils/module/instance_method_defined.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(mod, method_name, public: true, protected: true, private: false) ⇒ void

Parameters:

  • mod (Class, Module)
  • method_name (String, Symbol)
  • public (Boolean) (defaults to: true)
  • protected (Boolean) (defaults to: true)
  • private (Boolean) (defaults to: false)


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

def initialize(mod, method_name, public: true, protected: true, private: false)
  @mod = mod
  @method_name = method_name
  @public = public
  @protected = protected
  @private = private
end

Instance Attribute Details

#method_nameObject (readonly)

Returns the value of attribute method_name.



17
18
19
# File 'lib/convenient_service/utils/module/instance_method_defined.rb', line 17

def method_name
  @method_name
end

#modObject (readonly)

Returns the value of attribute mod.



11
12
13
# File 'lib/convenient_service/utils/module/instance_method_defined.rb', line 11

def mod
  @mod
end

#privateObject (readonly)

Returns the value of attribute private.



35
36
37
# File 'lib/convenient_service/utils/module/instance_method_defined.rb', line 35

def private
  @private
end

#protectedObject (readonly)

Returns the value of attribute protected.



29
30
31
# File 'lib/convenient_service/utils/module/instance_method_defined.rb', line 29

def protected
  @protected
end

#publicObject (readonly)

Returns the value of attribute public.



23
24
25
# File 'lib/convenient_service/utils/module/instance_method_defined.rb', line 23

def public
  @public
end

Instance Method Details

#callBoolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/convenient_service/utils/module/instance_method_defined.rb', line 60

def call
  Utils::Method.defined?(method_name, mod, public: public, protected: protected, private: private)
end