Sha256: d70bb75b19795e838cbce25f57c6b149763910d6143f60b50ce93783000146dd

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require 'source_finder/option_parser'
require 'high_water_mark/threshold'

module BigFiles
  # Configuration for bigfiles gem
  class Config
    NUM_FILES_DEFAULT = 3

    attr_reader :help, :num_files, :glob, :exclude, :minimum_high_water_mark

    def initialize(source_finder_option_parser: SourceFinder::OptionParser.new,
                   num_files: Config::NUM_FILES_DEFAULT,
                   quality_threshold:
                     ::HighWaterMark::Threshold.new('bigfiles'),
                   minimum_high_water_mark: 300,
                   help: false,
                   glob: source_finder_option_parser.default_source_files_glob,
                   exclude: source_finder_option_parser
                     .default_source_files_exclude_glob)
      @num_files = num_files
      @help = help
      @glob = glob
      @exclude = exclude
      @quality_threshold = quality_threshold
      @minimum_high_water_mark = minimum_high_water_mark
    end

    def high_water_mark
      @quality_threshold.threshold || @minimum_high_water_mark
    end

    def under_limit?(num_lines)
      num_lines <= high_water_mark
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bigfiles-0.3.0 lib/bigfiles/config.rb
bigfiles-0.2.2 lib/bigfiles/config.rb