Class: Rubycop::Analyzer::Ruby::If

Inherits:
ChainedBlock show all
Defined in:
lib/rubycop/analyzer/ruby/if.rb

Direct Known Subclasses

Unless

Instance Attribute Summary collapse

Attributes inherited from ChainedBlock

#blocks

Attributes inherited from Block

#params

Attributes inherited from List

#elements

Instance Method Summary collapse

Methods inherited from Statements

#to_block, #to_chained_block, #to_program

Methods inherited from List

#add

Methods inherited from Node

#accept

Constructor Details

#initialize(expression, statements = nil, else_block = nil) ⇒ If

Returns a new instance of If.



5
6
7
8
# File 'lib/rubycop/analyzer/ruby/if.rb', line 5

def initialize(expression, statements=nil, else_block=nil)
  @expression = expression
  super([else_block], statements, nil)
end

Instance Attribute Details

#expressionObject (readonly)

Returns the value of attribute expression.



9
10
11
# File 'lib/rubycop/analyzer/ruby/if.rb', line 9

def expression
  @expression
end