lib/signore/settings.rb in signore-0.4.2 vs lib/signore/settings.rb in signore-0.5.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'pathname' require_relative 'tags' module Signore class Settings @@ -9,29 +11,23 @@ def action args.first end + # :reek:UtilityFunction def repo_path dir = ENV.fetch('XDG_DATA_HOME') { File.expand_path('~/.local/share') } Pathname.new("#{dir}/signore/signatures.yml") end def tags - Tags.new(forbidden: forbidden, required: required) + negated, required = tag_names.partition { |name| name.start_with?('~') } + Tags.new(forbidden: negated.map { |neg| neg[1..-1] }, required: required) end - private_attr_reader :args - private - def forbidden - tag_names.select { |tag| tag.start_with?('~') }.map { |tag| tag[1..-1] } - end - - def required - tag_names.reject { |tag| tag.start_with?('~') } - end + attr_reader :args def tag_names args[1..-1] or [] end end