module TinyAtom

URI mixin that adds method to get domain.

Constants

EnclosureOptionalAttrs

param name => tag name

MediaThumbnailOptionalAttrs

param name => tag name

VERSION

Public Instance Methods

author(markup, h) click to toggle source

Add author tags if present.

# File lib/tinyatom/feed.rb, line 86
def author(markup, h)
  if h[:author_name]
    markup.author {
      markup.name h[:author_name]
      markup.email(h[:author_email])  if h[:author_email]
      markup.uri(h[:author_uri])  if h[:author_uri]
    }
  end
end
enclosure(markup, h) click to toggle source

Add enclosure tags if present.

# File lib/tinyatom/feed.rb, line 102
def enclosure(markup, h)
  if h[:enclosure_type] and h[:enclosure_href] and h[:enclosure_title]
    options = {}
    h.each do |k,v|
      if EnclosureOptionalAttrs.include?(k)
        options[EnclosureOptionalAttrs[k]] = v
      end
    end

    link markup, 'enclosure', h[:enclosure_type], h[:enclosure_href],
      h[:enclosure_title], options
  end
end
media_thumbnail(markup, h) click to toggle source

Add media:thumbnail tags if present.

# File lib/tinyatom/feed.rb, line 124
def media_thumbnail(markup, h)
  if h[:media_thumbnail_url]
    options = {}
    h.each do |k,v|
      if MediaThumbnailOptionalAttrs.include?(k)
        options[MediaThumbnailOptionalAttrs[k]] = v
      end
    end

    markup.media :thumbnail,
      { :url => h[:media_thumbnail_url] }.merge(options)
  end
end
via(markup, h) click to toggle source

Add via tags if present.

# File lib/tinyatom/feed.rb, line 139
def via(markup, h)
  if h[:via_type] and h[:via_href] and h[:via_title]
    link markup, 'via', h[:via_type], h[:via_href], h[:via_title]
  end
end