Sha256: 75d73bc15d5a396e50e53fa69eb76855cd69bceb1b785c2ccea835f7a517ff32

Contents?: true

Size: 664 Bytes

Versions: 21

Compression:

Stored size: 664 Bytes

Contents

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

21 entries across 21 versions & 1 rubygems

Version Path
onebox-1.8.69 lib/onebox/engine/trello_onebox.rb