Sha256: 57251c67532f84845811bb88f5e4cec3c61335daea82b8bcf621c3b3cabb067a

Contents?: true

Size: 417 Bytes

Versions: 1

Compression:

Stored size: 417 Bytes

Contents

module SandiMeter
  class LOCChecker < Struct.new(:file_lines)

    MAX_LOC = {
      'def'   => 5,
      'class' => 100
    }

    def check(params, token)
      _, first_line, last_line = params
      locs_size(first_line, last_line) <= MAX_LOC[token]
    end

    private
    def locs_size(first_line, last_line)
      file_lines[first_line - 1..last_line - 1].map(&:strip).reject(&:empty?).size
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sandi_meter-0.0.2 lib/sandi_meter/loc_checker.rb