Class: ImproveYourCode::Context::SingletonMethodContext

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

Instance Attribute Summary

Attributes inherited from MethodContext

#refs, #visibility

Attributes inherited from CodeContext

#children, #exp, #parent, #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, #each, #full_name, #initialize, #local_nodes, #matches?, #number_of_statements, #record_call_to, #record_use_of_self, #register_with_parent

Constructor Details

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

Instance Method Details

#apply_current_visibility(current_visibility) ⇒ Object



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

def apply_current_visibility(current_visibility)
  super if defined_as_instance_method?
end

#defined_as_instance_method?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/improve_your_code/context/singleton_method_context.rb', line 20

def defined_as_instance_method?
  type == :def
end

#instance_method?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/improve_your_code/context/singleton_method_context.rb', line 12

def instance_method?
  false
end

#module_function?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/improve_your_code/context/singleton_method_context.rb', line 16

def module_function?
  false
end

#singleton_method?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/improve_your_code/context/singleton_method_context.rb', line 8

def singleton_method?
  true
end