Class: WhatDyaReturn::Processor
- Inherits:
-
Object
- Object
- WhatDyaReturn::Processor
- Defined in:
- lib/what_dya_return/processor.rb
Constant Summary collapse
- BRANCH_CHECKERS =
rubocop:disable Layout/HashAlignment
{ WhatDyaReturn::AST::BeginNode => :check_begin_node, WhatDyaReturn::AST::ReturnNode => :check_return_node, WhatDyaReturn::AST::IfNode => :check_if_node, WhatDyaReturn::AST::CaseNode => :check_case_node, WhatDyaReturn::AST::RescueNode => :check_rescue_node, WhatDyaReturn::AST::EnsureNode => :check_ensure_node, WhatDyaReturn::AST::WhileNode => :check_while_node, WhatDyaReturn::AST::UntilNode => :check_until_node, WhatDyaReturn::AST::ForNode => :check_for_node, WhatDyaReturn::AST::BreakNode => :check_break_node, WhatDyaReturn::AST::BlockNode => :check_block_node, WhatDyaReturn::AST::NextNode => :check_next_node }.freeze
Instance Method Summary collapse
Instance Method Details
#process(node) ⇒ Array<RuboCop::AST::Node>
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/what_dya_return/processor.rb', line 30 def process(node) @return_nodes = [] if node.body.nil? # `def foo; end` @return_nodes << nil else check_branch(node.body, node) end @return_nodes end |