Sha256: 1e5de0b6ec8643d3612253c037a9f2ab3e49e5db9a8bc25fc6fad1b7229022c8

Contents?: true

Size: 674 Bytes

Versions: 53

Compression:

Stored size: 674 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

53 entries across 53 versions & 1 rubygems

Version Path
onebox-1.8.68 lib/onebox/engine/trello_onebox.rb
onebox-1.8.67 lib/onebox/engine/trello_onebox.rb
onebox-1.8.66 lib/onebox/engine/trello_onebox.rb
onebox-1.8.65 lib/onebox/engine/trello_onebox.rb
onebox-1.8.64 lib/onebox/engine/trello_onebox.rb
onebox-1.8.63 lib/onebox/engine/trello_onebox.rb
onebox-1.8.62 lib/onebox/engine/trello_onebox.rb
onebox-1.8.61 lib/onebox/engine/trello_onebox.rb
onebox-1.8.60 lib/onebox/engine/trello_onebox.rb
onebox-1.8.59 lib/onebox/engine/trello_onebox.rb
onebox-1.8.58 lib/onebox/engine/trello_onebox.rb
onebox-1.8.57 lib/onebox/engine/trello_onebox.rb
onebox-1.8.55 lib/onebox/engine/trello_onebox.rb
onebox-1.8.54 lib/onebox/engine/trello_onebox.rb
onebox-1.8.53 lib/onebox/engine/trello_onebox.rb
onebox-1.8.52 lib/onebox/engine/trello_onebox.rb
onebox-1.8.51 lib/onebox/engine/trello_onebox.rb
onebox-1.8.50 lib/onebox/engine/trello_onebox.rb
onebox-1.8.49 lib/onebox/engine/trello_onebox.rb
onebox-1.8.48 lib/onebox/engine/trello_onebox.rb