Sha256: f9879943860c2a2f545011abb0c65f5ad52cb0ee1ec2c27b379663d1f9cf6d9a

Contents?: true

Size: 673 Bytes

Versions: 79

Compression:

Stored size: 673 Bytes

Contents

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 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

79 entries across 79 versions & 1 rubygems

Version Path
onebox-1.8.27 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.26 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.25 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.24 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.23 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.22 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.21 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.20 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.19 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.18 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.17 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.16 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.15 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.14 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.13 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.12 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.11 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.10 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.9 lib/onebox/mixins/twitch_onebox.rb