Sha256: 0949371f4c2bad5d092969fa3ca5e7dddf47d2664b50fdf03c736ad449ccee53

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

module Reviewer
  class Arguments
    # Handles the logic of translating tag arguments
    class Tags
      attr_accessor :provided, :keywords

      alias raw provided

      def initialize(provided: Reviewer.arguments.tags.raw, keywords: Reviewer.arguments.keywords.for_tags)
        @provided = Array(provided)
        @keywords = Array(keywords)
      end

      def to_a
        tag_list
      end

      def to_s
        to_a.join(',')
      end

      def inspect
        {
          provided: provided,
          from_keywords: keywords
        }
      end

      private

      def tag_list
        @tag_list ||= [
          *provided,
          *keywords
        ].compact.sort.uniq
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reviewer-0.1.3 lib/reviewer/arguments/tags.rb