Class: Reek::IfContext
- Inherits:
-
CodeContext
- Object
- CodeContext
- Reek::IfContext
- Defined in:
- lib/reek/if_context.rb
Instance Attribute Summary collapse
-
#if_expr ⇒ Object
readonly
Returns the value of attribute if_expr.
Attributes inherited from CodeContext
Instance Method Summary collapse
-
#initialize(outer, exp) ⇒ IfContext
constructor
A new instance of IfContext.
- #outer_name ⇒ Object
- #tests_a_parameter? ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from CodeContext
#matches?, #method_missing, #num_methods
Constructor Details
#initialize(outer, exp) ⇒ IfContext
Returns a new instance of IfContext.
7 8 9 10 11 |
# File 'lib/reek/if_context.rb', line 7 def initialize(outer, exp) @outer = outer @exp = exp @if_expr = exp[1] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Reek::CodeContext
Instance Attribute Details
#if_expr ⇒ Object (readonly)
Returns the value of attribute if_expr.
5 6 7 |
# File 'lib/reek/if_context.rb', line 5 def if_expr @if_expr end |
Instance Method Details
#outer_name ⇒ Object
17 18 19 |
# File 'lib/reek/if_context.rb', line 17 def outer_name @outer.outer_name end |
#tests_a_parameter? ⇒ Boolean
13 14 15 |
# File 'lib/reek/if_context.rb', line 13 def tests_a_parameter? @if_expr[0] == :lvar and has_parameter(@if_expr[1]) end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/reek/if_context.rb', line 21 def to_s @outer.to_s end |