Class: Onebox::Engine::StackExchangeOnebox

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

Instance Attribute Summary

Attributes included from Onebox::Engine

#errors, #options, #timeout, #uri

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LayoutSupport

#layout, max_text, #to_html

Methods included from Onebox::Engine

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

Class Method Details

.domainsObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/onebox/engine/stack_exchange_onebox.rb', line 10

def self.domains
  %w[
    stackexchange.com
    stackoverflow.com
    superuser.com
    serverfault.com
    askubuntu.com
    stackapps.com
    mathoverflow.net
  ].map { |domain| Regexp.escape(domain) }
end

Instance Method Details

#always_https?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/onebox/engine/stack_exchange_onebox.rb', line 26

def always_https?
  uri.host.split(".").length <= 3
end