Sha256: 180886cf7d3961c1cc2f0e215574cf401d4c176a2e12c3977beb801ccfc471cd
Contents?: true
Size: 659 Bytes
Versions: 2
Compression:
Stored size: 659 Bytes
Contents
require_relative '../ast/node' module Reek module Context # Responsible for counting the statements in a `CodeContext`. class StatementCounter attr_reader :value def initialize @value = 0 end def increase_by(sexp) return unless sexp case sexp when Reek::AST::Node self.value = value + 1 when Array self.value = value + sexp.length else raise ArgumentError, "Invalid type #{sexp} given" end end def decrease_by(number) self.value = value - number end private attr_writer :value end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reek-3.11 | lib/reek/context/statement_counter.rb |
reek-3.10.2 | lib/reek/context/statement_counter.rb |