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.47 lib/onebox/engine/trello_onebox.rb
onebox-1.8.46 lib/onebox/engine/trello_onebox.rb
onebox-1.8.45 lib/onebox/engine/trello_onebox.rb
onebox-1.8.44 lib/onebox/engine/trello_onebox.rb
onebox-1.8.43 lib/onebox/engine/trello_onebox.rb
onebox-1.8.42 lib/onebox/engine/trello_onebox.rb
onebox-1.8.41 lib/onebox/engine/trello_onebox.rb
onebox-1.8.40 lib/onebox/engine/trello_onebox.rb
onebox-1.8.39 lib/onebox/engine/trello_onebox.rb
onebox-1.8.38 lib/onebox/engine/trello_onebox.rb
onebox-1.8.36 lib/onebox/engine/trello_onebox.rb
onebox-1.8.35 lib/onebox/engine/trello_onebox.rb
onebox-1.8.34 lib/onebox/engine/trello_onebox.rb
onebox-1.8.33 lib/onebox/engine/trello_onebox.rb
onebox-1.8.32 lib/onebox/engine/trello_onebox.rb
onebox-1.8.31 lib/onebox/engine/trello_onebox.rb
onebox-1.8.30 lib/onebox/engine/trello_onebox.rb
onebox-1.8.29 lib/onebox/engine/trello_onebox.rb
onebox-1.8.28 lib/onebox/engine/trello_onebox.rb
onebox-1.8.27 lib/onebox/engine/trello_onebox.rb