Class: Onebox::Engine::StackExchangeOnebox

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

Constant Summary

Constants included from Onebox::Engine

DEFAULT

Instance Attribute Summary

Attributes included from Onebox::Engine

#timeout, #uri

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LayoutSupport

#layout, max_text, #to_html

Methods included from Onebox::Engine

engines, included, #initialize, #options, #options=, #placeholder_html, #to_html

Class Method Details

.domainsObject



10
11
12
13
# 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)


17
18
19
# File 'lib/onebox/engine/stack_exchange_onebox.rb', line 17

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