Class: WhyClasses::Options

Inherits:
Data
  • Object
show all
Defined in:
lib/why_classes/options.rb

Overview

Parsed CLI options (dogfooding the gem's own advice: a plain Data value).

mode: :report | :diff | :fix

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#config_pathObject (readonly)

Returns the value of attribute config_path

Returns:

  • (Object)

    the current value of config_path



7
8
9
# File 'lib/why_classes/options.rb', line 7

def config_path
  @config_path
end

#exceptObject (readonly)

Returns the value of attribute except

Returns:

  • (Object)

    the current value of except



7
8
9
# File 'lib/why_classes/options.rb', line 7

def except
  @except
end

#fail_levelObject (readonly)

Returns the value of attribute fail_level

Returns:

  • (Object)

    the current value of fail_level



7
8
9
# File 'lib/why_classes/options.rb', line 7

def fail_level
  @fail_level
end

#fix_unsafeObject (readonly)

Returns the value of attribute fix_unsafe

Returns:

  • (Object)

    the current value of fix_unsafe



7
8
9
# File 'lib/why_classes/options.rb', line 7

def fix_unsafe
  @fix_unsafe
end

#formatObject (readonly)

Returns the value of attribute format

Returns:

  • (Object)

    the current value of format



7
8
9
# File 'lib/why_classes/options.rb', line 7

def format
  @format
end

#modeObject (readonly)

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



7
8
9
# File 'lib/why_classes/options.rb', line 7

def mode
  @mode
end

#onlyObject (readonly)

Returns the value of attribute only

Returns:

  • (Object)

    the current value of only



7
8
9
# File 'lib/why_classes/options.rb', line 7

def only
  @only
end

#pathsObject (readonly)

Returns the value of attribute paths

Returns:

  • (Object)

    the current value of paths



7
8
9
# File 'lib/why_classes/options.rb', line 7

def paths
  @paths
end

#railsObject (readonly)

Returns the value of attribute rails

Returns:

  • (Object)

    the current value of rails



7
8
9
# File 'lib/why_classes/options.rb', line 7

def rails
  @rails
end

Class Method Details

.defaults(**overrides) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/why_classes/options.rb', line 18

def self.defaults(**overrides)
  new(**{
    paths: [],
    mode: :report,
    fix_unsafe: false,
    only: [],
    except: [],
    format: "progress",
    config_path: nil,
    rails: nil,
    fail_level: "convention"
  }.merge(overrides))
end