Sha256: a1c25c36daa1245417ad8dca3a9829f7dd619cfbe62d578df9939d7ad7297b48

Contents?: true

Size: 485 Bytes

Versions: 39

Compression:

Stored size: 485 Bytes

Contents

# frozen_string_literal: true

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)
        self.value = value + sexp.length if sexp
      end

      def decrease_by(number)
        self.value = value - number
      end

      private

      attr_writer :value
    end
  end
end

Version data entries

39 entries across 37 versions & 2 rubygems

Version Path
reek-5.3.1 lib/reek/context/statement_counter.rb
reek-5.3.0 lib/reek/context/statement_counter.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/context/statement_counter.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/context/statement_counter.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/context/statement_counter.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/context/statement_counter.rb
reek-5.2.0 lib/reek/context/statement_counter.rb
reek-5.1.0 lib/reek/context/statement_counter.rb
reek-5.0.2 lib/reek/context/statement_counter.rb
reek-5.0.1 lib/reek/context/statement_counter.rb
reek-5.0.0 lib/reek/context/statement_counter.rb
reek-4.8.2 lib/reek/context/statement_counter.rb
reek-4.8.1 lib/reek/context/statement_counter.rb
reek-4.8.0 lib/reek/context/statement_counter.rb
reek-4.7.3 lib/reek/context/statement_counter.rb
reek-4.7.2 lib/reek/context/statement_counter.rb
reek-4.7.1 lib/reek/context/statement_counter.rb
reek-4.7.0 lib/reek/context/statement_counter.rb
reek-4.6.2 lib/reek/context/statement_counter.rb