Class: Onebox::Engine::DiscourseTopicOnebox

Inherits:
Object
  • Object
show all
Includes:
Onebox::Engine, StandardEmbed, LayoutSupport
Defined in:
lib/onebox/engine/discourse_topic_onebox.rb

Instance Attribute Summary

Attributes included from Onebox::Engine

#errors, #options, #timeout, #uri, #url

Instance Method Summary collapse

Methods included from LayoutSupport

#layout, max_text, #to_html

Methods included from StandardEmbed

add_oembed_provider, add_opengraph_provider, #always_https?, oembed_providers, opengraph_providers, #raw

Methods included from Onebox::Engine

all_iframe_origins, engines, included, #initialize, origins_to_regexes, #placeholder_html, #to_html

Instance Method Details

#dataObject Also known as: verified_data



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/onebox/engine/discourse_topic_onebox.rb', line 12

def data
  @data ||= {
    categories: categories,
    link: link,
    article_published_time: published_time.strftime("%-d %b %y"),
    article_published_time_title: published_time.strftime("%I:%M%p - %d %B %Y"),
    domain: html_entities.decode(raw[:site_name].truncate(80, separator: " ")),
    description: html_entities.decode(raw[:description].truncate(250, separator: " ")),
    title: html_entities.decode(raw[:title].truncate(80, separator: " ")),
    image: image,
    render_tags?: render_tags?,
    render_category_block?: render_category_block?,
  }.reverse_merge(raw)
end