Class: Reek::Context::AttributeContext

Inherits:
CodeContext show all
Defined in:
lib/reek/context/attribute_context.rb

Overview

A context wrapper for attribute definitions found in a syntax tree.

Direct Known Subclasses

SingletonAttributeContext

Instance Attribute Summary collapse

Attributes inherited from CodeContext

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

Instance Method Summary collapse

Methods inherited from CodeContext

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

Constructor Details

#initialize(exp, send_expression) ⇒ AttributeContext

Returns a new instance of AttributeContext.



14
15
16
17
18
# File 'lib/reek/context/attribute_context.rb', line 14

def initialize(exp, send_expression)
  @visibility = :public
  @send_expression = send_expression
  super(exp)
end

Instance Attribute Details

#send_expressionObject (readonly, private)

Returns the value of attribute send_expression.



34
35
36
# File 'lib/reek/context/attribute_context.rb', line 34

def send_expression
  @send_expression
end

#visibilityObject

Returns the value of attribute visibility.



12
13
14
# File 'lib/reek/context/attribute_context.rb', line 12

def visibility
  @visibility
end

Instance Method Details

#apply_current_visibility(current_visibility) ⇒ Object



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

def apply_current_visibility(current_visibility)
  self.visibility = current_visibility
end

#full_commentObject



20
21
22
# File 'lib/reek/context/attribute_context.rb', line 20

def full_comment
  send_expression.full_comment || ''
end

#instance_method?Boolean

Returns:

  • (Boolean)


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

def instance_method?
  true
end