Module Atom::HasCategories
In: lib/atom/element.rb

Methods

included   tag_with  

Public Class methods

[Source]

# File lib/atom/element.rb, line 660
    def HasCategories.included(klass)
      klass.atom_elements :category, :categories, Atom::Category
    end

Public Instance methods

categorize the entry with each of an array or a space-separated

  string

[Source]

# File lib/atom/element.rb, line 666
    def tag_with(tags, delimiter = ' ')
      return if not tags or tags.empty?

      tag_list = unless tags.is_a?(String)
                   tags
                 else
                   tags = tags.split(delimiter)
                   tags.map! { |t| t.strip }
                   tags.reject! { |t| t.empty? }
                   tags.uniq
                 end

      tag_list.each do |tag|
        unless categories.any? { |c| c.term == tag }
          categories.new :term => tag
        end
      end
    end

[Validate]