Initialize using options ahsh
This commit is contained in:
parent
3ca8d24b88
commit
f41d9dbb39
1 changed files with 5 additions and 5 deletions
|
@ -12,14 +12,14 @@ require 'colorize'
|
|||
class FormatStaged
|
||||
attr_reader :formatter, :patterns, :update, :write, :verbose
|
||||
|
||||
def initialize(formatter:, patterns:, update: true, write: true, verbose: true, color_output: nil)
|
||||
def initialize(formatter:, patterns:, **options)
|
||||
@formatter = formatter
|
||||
@patterns = patterns
|
||||
@update = update
|
||||
@write = write
|
||||
@verbose = verbose
|
||||
@update = options.fetch(:update, true)
|
||||
@write = options.fetch(:write, true)
|
||||
@verbose = options.fetch(:verbose, true)
|
||||
|
||||
String.disable_colorization = !(color_output || $stdout.isatty)
|
||||
String.disable_colorization = !options.fetch(:color_output, $stdout.isatty)
|
||||
end
|
||||
|
||||
def run
|
||||
|
|
Loading…
Add table
Reference in a new issue