vendor/jruby/1.9/gems/reek-1.6.5/lib/reek/smells/repeated_conditional.rb
#
# Returns a Hash listing all of the conditional expressions in
# the given syntax tree together with the number of times each
# occurs. Ignores nested classes and modules.
#
Returns a Hash listing all of the conditional expressions in
the given syntax tree together with the number of times each
occurs. Ignores nested classes and modules.
Returns a Hash listing all of the conditional expressions in the given syntax tree together with the number of times each occurs . Ignores nested classes and modules .
def conditional_counts(sexp)
        result = Hash.new { |hash, key| hash[key] = [] }
        collector = proc do |node|
          next unless (condition = node.condition)
          next if condition == BLOCK_GIVEN_CONDITION
          result[condition].push(condition.line)
        end
        [:if, :case].each { |stmt| sexp.local_nodes(stmt, &collector) }
        result
      end
def conditional_counts ( sexp ) result = Hash . new { | hash , key | hash [ key ] = [ ] } collector = proc do | node | next unless ( condition = node . condition ) next if condition == BLOCK_GIVEN_CONDITION result [ condition ] . push ( condition . line ) end [ :if , :case ] . each { | stmt | sexp . local_nodes ( stmt , & collector ) } result end
Returns a Hash listing all of the conditional expressions in
the given syntax tree together with the number of times each
occurs.
Returns a Hash listing all of the conditional expressions in the given syntax tree together with the number of times each occurs .
sexp