Class: Gry::Option
- Inherits:
-
Object
- Object
- Gry::Option
- Defined in:
- lib/gry/option.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#display_disabled_cops ⇒ Object
readonly
Returns the value of attribute display_disabled_cops.
-
#fast ⇒ Object
readonly
Returns the value of attribute fast.
-
#max_count ⇒ Object
readonly
Returns the value of attribute max_count.
-
#metrics_percentile ⇒ Object
readonly
Returns the value of attribute metrics_percentile.
-
#min_difference ⇒ Object
readonly
Returns the value of attribute min_difference.
-
#process ⇒ Object
readonly
Returns the value of attribute process.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Option
constructor
A new instance of Option.
Constructor Details
#initialize(argv) ⇒ Option
Returns a new instance of Option.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/gry/option.rb', line 5 def initialize(argv) opt = OptionParser.new @version = false @process = Parallel.processor_count @fast = true @max_count = 10 @min_difference = 10 @display_disabled_cops = false @metrics_percentile = 95 @cache = true @raw = false opt. = 'Usage: gry [options] [Cop1, Cop2, ...]' opt.on('-d', '--debug', 'Output debug log.') {Gry.debug_mode!} opt.on('-p', '--process=VAL', 'Number of parallel processes.') {|v| @process = v.to_i} opt.on('-v', '--version', 'Display version.') {@version = true} opt.on('--[no-]fast', 'Run only fast cops. Default: true') {|v| @fast = v} opt.on('--max-count=10', 'Upper limit of issues.') {|v| @max_count = v.to_i} opt.on('--min-difference=10', 'Lower limit of issues number difference') {|v| @min_difference = v.to_i} opt.on('--metrics-percentile=95', 'Percentile for allowed complex code') {|v| @metrics_percentile = v.to_i} opt.on('--display-disabled-cops', 'Display disabled cops') {|v| @display_disabled_cops = v} opt.on('--[no-]cache', 'Run gry with cache. Default: true') {|v| @cache = v} opt.on('--raw', 'Display raw data(JSON). Default: false') {|v| @raw = v} @args = opt.parse(argv) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
3 4 5 |
# File 'lib/gry/option.rb', line 3 def args @args end |
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
3 4 5 |
# File 'lib/gry/option.rb', line 3 def cache @cache end |
#display_disabled_cops ⇒ Object (readonly)
Returns the value of attribute display_disabled_cops.
3 4 5 |
# File 'lib/gry/option.rb', line 3 def display_disabled_cops @display_disabled_cops end |
#fast ⇒ Object (readonly)
Returns the value of attribute fast.
3 4 5 |
# File 'lib/gry/option.rb', line 3 def fast @fast end |
#max_count ⇒ Object (readonly)
Returns the value of attribute max_count.
3 4 5 |
# File 'lib/gry/option.rb', line 3 def max_count @max_count end |
#metrics_percentile ⇒ Object (readonly)
Returns the value of attribute metrics_percentile.
3 4 5 |
# File 'lib/gry/option.rb', line 3 def metrics_percentile @metrics_percentile end |
#min_difference ⇒ Object (readonly)
Returns the value of attribute min_difference.
3 4 5 |
# File 'lib/gry/option.rb', line 3 def min_difference @min_difference end |
#process ⇒ Object (readonly)
Returns the value of attribute process.
3 4 5 |
# File 'lib/gry/option.rb', line 3 def process @process end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
3 4 5 |
# File 'lib/gry/option.rb', line 3 def raw @raw end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
3 4 5 |
# File 'lib/gry/option.rb', line 3 def version @version end |