Class: BigFiles::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/bigfiles/config.rb

Overview

Configuration for bigfiles gem

Constant Summary collapse

NUM_FILES_DEFAULT =
3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#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) ⇒ Config

Returns a new instance of Config.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bigfiles/config.rb', line 13

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

Instance Attribute Details

#excludeObject (readonly)

Returns the value of attribute exclude.



11
12
13
# File 'lib/bigfiles/config.rb', line 11

def exclude
  @exclude
end

#globObject (readonly)

Returns the value of attribute glob.



11
12
13
# File 'lib/bigfiles/config.rb', line 11

def glob
  @glob
end

#helpObject (readonly)

Returns the value of attribute help.



11
12
13
# File 'lib/bigfiles/config.rb', line 11

def help
  @help
end

#minimum_high_water_markObject (readonly)

Returns the value of attribute minimum_high_water_mark.



11
12
13
# File 'lib/bigfiles/config.rb', line 11

def minimum_high_water_mark
  @minimum_high_water_mark
end

#num_filesObject (readonly)

Returns the value of attribute num_files.



11
12
13
# File 'lib/bigfiles/config.rb', line 11

def num_files
  @num_files
end

Instance Method Details

#high_water_markObject



30
31
32
# File 'lib/bigfiles/config.rb', line 30

def high_water_mark
  @quality_threshold.threshold || @minimum_high_water_mark
end

#under_limit?(num_lines) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/bigfiles/config.rb', line 34

def under_limit?(num_lines)
  num_lines <= high_water_mark
end