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.48 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.47 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.46 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.45 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.44 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.43 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.42 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.41 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.40 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.39 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.38 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.36 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.35 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.34 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.33 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.32 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.31 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.30 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.29 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.28 lib/onebox/mixins/twitch_onebox.rb