Class: ConvenientService::Utils::Module::ClassMethodDefined

Inherits:
Support::Command show all
Defined in:
lib/convenient_service/utils/module/class_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)


54
55
56
57
58
59
60
# File 'lib/convenient_service/utils/module/class_method_defined.rb', line 54

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.



22
23
24
# File 'lib/convenient_service/utils/module/class_method_defined.rb', line 22

def method_name
  @method_name
end

#modObject (readonly)

Returns the value of attribute mod.



16
17
18
# File 'lib/convenient_service/utils/module/class_method_defined.rb', line 16

def mod
  @mod
end

#privateObject (readonly)

Returns the value of attribute private.



40
41
42
# File 'lib/convenient_service/utils/module/class_method_defined.rb', line 40

def private
  @private
end

#protectedObject (readonly)

Returns the value of attribute protected.



34
35
36
# File 'lib/convenient_service/utils/module/class_method_defined.rb', line 34

def protected
  @protected
end

#publicObject (readonly)

Returns the value of attribute public.



28
29
30
# File 'lib/convenient_service/utils/module/class_method_defined.rb', line 28

def public
  @public
end

Instance Method Details

#callBoolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/convenient_service/utils/module/class_method_defined.rb', line 65

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