Sha256: dbe5f8b2d466960c8c2238d5c961182058673e88a0f1197e4986b7111f951b04

Contents?: true

Size: 453 Bytes

Versions: 17

Compression:

Stored size: 453 Bytes

Contents

module ActsAsTaggableOn
  ##
  # Returns a new TagList using the given tag string.
  #
  # Example:
  # tag_list = ActsAsTaggableOn::GenericParser.new.parse("One , Two, Three")
  # tag_list # ["One", "Two", "Three"]
  class GenericParser
    def initialize(tag_list)
      @tag_list = tag_list
    end

    def parse
      TagList.new.tap do |tag_list|
        tag_list.add @tag_list.split(',').map(&:strip).reject(&:empty?)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
acts-as-taggable-on-fix-8.1.1 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-fix-8.1.0 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-8.1.0 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-8.0.0 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-7.0.0 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-6.5.0 lib/acts_as_taggable_on/generic_parser.rb
sb-acts-as-taggable-on-6.5.0 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-6.0.0 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-5.0.0 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-4.0.0 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-4.0.0.pre lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-3.5.0 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-3.4.4 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-3.4.3 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-3.4.2 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-3.4.1 lib/acts_as_taggable_on/generic_parser.rb
acts-as-taggable-on-3.4.0 lib/acts_as_taggable_on/generic_parser.rb