Module: Onebox::Mixins::TwitchOnebox::InstanceMethods

Defined in:
lib/onebox/mixins/twitch_onebox.rb

Instance Method Summary collapse

Instance Method Details

#base_urlObject



18
19
20
# File 'lib/onebox/mixins/twitch_onebox.rb', line 18

def base_url
  "player.twitch.tv/?"
end

#placeholder_htmlObject



22
23
24
# File 'lib/onebox/mixins/twitch_onebox.rb', line 22

def placeholder_html
  ::Onebox::Helpers.video_placeholder_html
end

#to_htmlObject



26
27
28
29
30
# File 'lib/onebox/mixins/twitch_onebox.rb', line 26

def to_html
  <<~HTML
  <iframe src="https://#{base_url}#{query_params}&parent=#{Discourse.current_hostname}&autoplay=false" width="620" height="378" frameborder="0" style="overflow: hidden;" scrolling="no" allowfullscreen="allowfullscreen"></iframe>
  HTML
end

#twitch_idObject



14
15
16
# File 'lib/onebox/mixins/twitch_onebox.rb', line 14

def twitch_id
  @url.match(self.class.twitch_regexp)[1]
end