Module: PackStats::Tags

Extended by:
T::Sig
Defined in:
lib/pack_stats/tags.rb

Class Method Summary collapse

Class Method Details

.for(colon_delimited_tag_strings) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pack_stats/tags.rb', line 8

def self.for(colon_delimited_tag_strings)
  colon_delimited_tag_strings.map do |colon_delimited_tag_string|
    key, value = colon_delimited_tag_string.split(':')
    raise StandardError, "Improperly formatted tag `#{colon_delimited_tag_string}`" if key.nil? || value.nil?

    Tag.new(
      key: key,
      value: value
    )
  end
end