Sha256: ff561b2517a34e13b287d4a9e9644aa713bef4d1e8a22492223d70489271ab0d
Contents?: true
Size: 833 Bytes
Versions: 2
Compression:
Stored size: 833 Bytes
Contents
# frozen_string_literal: true module WhatDyaReturn module AST # # A node extension for `if` nodes. # class IfNode < ::RuboCop::AST::IfNode # # @example # # if false # or `nil` # 42 # unreachable # else # run # end # # @return [Boolean] # def if_branch_reachable? ((if? || ternary? || elsif?) && condition.falsey_literal?.!) || (unless? && condition.truthy_literal?.!) end # # @example # # if true # 42 # else # run # unreachable # end # # @return [Boolean] # def else_branch_reachable? ((if? || ternary? || elsif?) && condition.truthy_literal?.!) || (unless? && condition.falsey_literal?.!) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
what_dya_return-0.2.1 | lib/what_dya_return/ast/node/if_node.rb |
what_dya_return-0.2.0 | lib/what_dya_return/ast/node/if_node.rb |