Sha256: 293fb98be98f4239dfa9927c20c436ee242fbc64a828f1b9ea0976d9ae005d51

Contents?: true

Size: 695 Bytes

Versions: 10

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true

module Onebox
  module Engine
    class TrelloOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https:\/\/trello\.com\/[bc]\/\W*/)
      always_https

      def to_html
        link = "https://trello.com/#{match[:type]}/#{match[:key]}.html"

        height = match[:type] == 'b' ? 400 : 200

        <<-HTML
          <iframe src=\"#{link}\" width=\"100%\" height=\"#{height}\" frameborder=\"0\" style=\"border:0\"></iframe>
        HTML
      end

      private
      def match
        return @match if @match

        @match = @url.match(%{trello\.com/(?<type>[^/]+)/(?<key>[^/]+)/?\W*})

        @match
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
onebox-1.8.99 lib/onebox/engine/trello_onebox.rb
onebox-1.8.98 lib/onebox/engine/trello_onebox.rb
onebox-1.8.97 lib/onebox/engine/trello_onebox.rb
onebox-1.8.96 lib/onebox/engine/trello_onebox.rb
onebox-1.8.95 lib/onebox/engine/trello_onebox.rb
onebox-1.8.94 lib/onebox/engine/trello_onebox.rb
onebox-1.8.93 lib/onebox/engine/trello_onebox.rb
onebox-1.8.92 lib/onebox/engine/trello_onebox.rb
onebox-1.8.91 lib/onebox/engine/trello_onebox.rb
onebox-1.8.90 lib/onebox/engine/trello_onebox.rb