Class: Metka::TagList

Inherits:
Set
  • Object
show all
Defined in:
lib/metka/tag_list.rb

Overview

The parsed form of a tag string: an ordered, de-duplicated set of tags.

Metka::GenericParser.instance.call("ruby, rails, ruby").to_s
#=> "ruby, rails"

Instance Method Summary collapse

Instance Method Details

#to_sObject

Set#to_s is an alias of #inspect, so a tag list rendered itself as "#<Set: \"ruby\">". This is a user-facing value, so render it the way it was written.

Joins on the configured delimiter, so it round-trips through the parser. A parser subclass that overrides #delimiter privately — as the dummy app's CustomParser does — is not visible from here, so a tag list it produced renders with the configured delimiter rather than that parser's.



19
20
21
# File 'lib/metka/tag_list.rb', line 19

def to_s
  to_a.join("#{Metka.delimiter} ")
end