Sha256: 687c607e492bf68390997aa5b5c361b82375a454708259c94bfeb6229b37222d

Contents?: true

Size: 797 Bytes

Versions: 32

Compression:

Stored size: 797 Bytes

Contents

# frozen_string_literal: true

module Onebox
  module Mixins
    module TwitchOnebox

      def self.included(klass)
        klass.include(Onebox::Engine)
        klass.matches_regexp(klass.twitch_regexp)
        klass.include(InstanceMethods)
      end

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

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

        def placeholder_html
          ::Onebox::Helpers.video_placeholder_html
        end

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

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
onebox-1.9.28.4 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.28.3 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.28.2 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.28.1 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.28 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.27.2 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.27.1 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.26 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.25 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.24 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.23 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.22 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.21 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.20 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.19 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.18 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.17 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.16 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.15 lib/onebox/mixins/twitch_onebox.rb
onebox-1.9.14 lib/onebox/mixins/twitch_onebox.rb