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

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(oembed_response)
    case oembed_response.field('type')
    when 'photo'
        return "<img src='#{oembed_response.field("url")}' width='#{oembed_response.field("width")}' height='#{oembed_response.field("height")}' />"
    when 'video'
        return oembed_response.field('html')
    when 'link'
        return "<a href='#{oembed_response.url}'>#{oembed_response.field('html') || oembed_response.url}</a>"
    when 'rich'
        return oembed_response.field('html')
    else
        "<a href='#{oembed_response.url}'>#{oembed_response.field('html') || oembed_response.url}</a>"
    end
end

#refresh_rssObject



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

#rssObject

Access to the @@rss variable, used in the template



21
22
23
# File 'pummel.rb', line 21

def rss
    @@rss
end