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
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
link(markup, rel, type, href, title, options={})
click to toggle source
Create link tag.
# File lib/tinyatom/feed.rb, line 146 def link(markup, rel, type, href, title, options={}) markup.link({ :rel => rel, :type => type, :href => href, :title => title }.merge(options)) 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