Top Level Namespace
Constant Summary collapse
- @@rss_url =
"http://feeds.pinboard.in/rss/u:evaryont/"
- @@ic =
Iconv.new('UTF-8//IGNORE', 'UTF-8')
Instance Method Summary collapse
-
#generate_html(oembed_response) ⇒ Object
Return a string, the proper HTML for the OEmbed response.
- #refresh_rss ⇒ Object
-
#rss ⇒ Object
Access to the @@rss variable, used in the template.
Instance Method Details
#generate_html(oembed_response) ⇒ Object
Return a string, the proper HTML for the OEmbed response
Used in the template.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'pummel.rb', line 28 def generate_html() case .field('type') when 'photo' return "<img src='#{.field("url")}' width='#{.field("width")}' height='#{.field("height")}' />" when 'video' return .field('html') when 'link' return "<a href='#{.url}'>#{.field('html') || .url}</a>" when 'rich' return .field('html') else "<a href='#{.url}'>#{.field('html') || .url}</a>" end end |
#refresh_rss ⇒ Object
11 12 13 14 |
# File 'pummel.rb', line 11 def refresh_rss valid_string = @@ic.iconv(open(@@rss_url).read << ' ')[0..-2] @@rss = RSS::Parser.parse valid_string, false end |
#rss ⇒ Object
Access to the @@rss variable, used in the template
21 22 23 |
# File 'pummel.rb', line 21 def rss @@rss end |