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.89 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.88 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.87 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.86 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.85 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.84 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.83 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.82 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.81 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.80 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.79 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.78 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.77 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.76 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.75 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.74 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.73 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.72 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.71 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.70 lib/onebox/mixins/twitch_onebox.rb