Class: Reek::Context::SingletonMethodContext

Inherits:
MethodContext show all
Defined in:
lib/reek/context/singleton_method_context.rb

Overview

A context wrapper for any singleton method definition found in a syntax tree.

Instance Attribute Summary

Attributes inherited from MethodContext

#parent_exp, #refs, #visibility

Attributes inherited from CodeContext

#children, #exp, #parent, #refs, #statement_counter

Instance Method Summary collapse

Methods inherited from MethodContext

#default_assignments, #full_comment, #initialize, #method_context_class, #non_public_visibility?, #references_self?, #unused_params, #uses_param?, #uses_super_with_implicit_arguments?

Methods inherited from CodeContext

#append_child_context, #config_for, #configuration_via_code_commment, #each, #full_comment, #full_name, #initialize, #local_nodes, #matches?, #number_of_statements, #parent_config_for, #record_call_to, #record_use_of_self, #register_with_parent

Constructor Details

This class inherits a constructor from Reek::Context::MethodContext

Instance Method Details

#apply_current_visibility(current_visibility) ⇒ Object



28
29
30
# File 'lib/reek/context/singleton_method_context.rb', line 28

def apply_current_visibility(current_visibility)
  super if defined_as_instance_method?
end

#defined_as_instance_method?Boolean

Was this singleton method defined with an instance method-like syntax?

Returns:

  • (Boolean)


24
25
26
# File 'lib/reek/context/singleton_method_context.rb', line 24

def defined_as_instance_method?
  type == :def
end

#instance_method?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/reek/context/singleton_method_context.rb', line 15

def instance_method?
  false
end

#module_function?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/reek/context/singleton_method_context.rb', line 19

def module_function?
  false
end

#singleton_method?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/reek/context/singleton_method_context.rb', line 11

def singleton_method?
  true
end