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

#cache, #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


8
9
10
11
# File 'lib/onebox/engine/stack_exchange_onebox.rb', line 8

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


15
16
17
# File 'lib/onebox/engine/stack_exchange_onebox.rb', line 15

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