class Reviewer::Arguments::Tags
Handles the logic of translating tag arguments
Attributes
Public Class Methods
Generates an instace of parsed tags from the provided arguments @param provided: Reviewer.arguments
.tags.raw [Array<String>] tag arguments provided
directly via the -t or --tags flag on the command line.
@param keywords: Reviewer.arguments
.keywords [Array, String] keywords that can potentially
be translated to a list of tags based on the tags used in the configuration file
@return [Arguments::Tags] the container for extracting tags from the provided command line
arguments
# File lib/reviewer/arguments/tags.rb, line 19 def initialize(provided: Reviewer.arguments.tags.raw, keywords: Reviewer.arguments.keywords.for_tags) @provided = Array(provided) @keywords = Array(keywords) end
Public Instance Methods
Provides the full list of tags values derived from the command-line arguments
@return [Array<String>] full collection of the tag arguments as a string
# File lib/reviewer/arguments/tags.rb, line 27 def to_a tag_list end
Summary of the state of the tag arguments
@return [Hash] represents the summary of the tag values parsed from the command-line
# File lib/reviewer/arguments/tags.rb, line 41 def to_h { provided: provided.sort, from_keywords: keywords.sort } end
Provides the full list of tag values derived from the command-line arguments
@return [String] comma-separated string of the derived tag values
# File lib/reviewer/arguments/tags.rb, line 34 def to_s to_a.join(',') end
Private Instance Methods
Combines the sorted list of unique tags by merging the explicitly-provided tag arguments as well as those that were recognized from any relevant keyword arguments.
@return [Array] full list of tags passed via command-line including those matching keyword
arguments
# File lib/reviewer/arguments/tags.rb, line 56 def tag_list @tag_list ||= [ *provided, *keywords ].compact.sort.uniq end