Class: RubyCritic::Cli::Options::File

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic/cli/options/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename = './.rubycritic.yml') ⇒ File

Returns a new instance of File.


11
12
13
14
# File 'lib/rubycritic/cli/options/file.rb', line 11

def initialize(filename = './.rubycritic.yml')
  @filename = filename
  @options = {}
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename


9
10
11
# File 'lib/rubycritic/cli/options/file.rb', line 9

def filename
  @filename
end

#optionsObject (readonly)

Returns the value of attribute options


9
10
11
# File 'lib/rubycritic/cli/options/file.rb', line 9

def options
  @options
end

Instance Method Details

#parseObject


16
17
18
# File 'lib/rubycritic/cli/options/file.rb', line 16

def parse
  @options = YAML.load_file(filename) if ::File.file?(filename)
end

#to_hObject

rubocop:disable Metrics/MethodLength


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rubycritic/cli/options/file.rb', line 21

def to_h
  {
    mode: mode,
    root: root,
    formats: formats,
    deduplicate_symlinks: deduplicate_symlinks,
    paths: paths,
    suppress_ratings: suppress_ratings,
    minimum_score: minimum_score,
    no_browser: no_browser,
    base_branch: base_branch,
    feature_branch: feature_branch,
    threshold_score: threshold_score
  }
end