From f41d9dbb391cba328faab7af5df57b64938e76a5 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Sun, 29 May 2022 09:40:39 +0200 Subject: [PATCH] Initialize using options ahsh --- lib/format_staged.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/format_staged.rb b/lib/format_staged.rb index 0cae333..8aa2160 100644 --- a/lib/format_staged.rb +++ b/lib/format_staged.rb @@ -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