Sha256: 4b93db63620a07728144e8c8a08e67348aa1f54982f818b4a73ff6e5dad2bb0c

Contents?: true

Size: 392 Bytes

Versions: 5

Compression:

Stored size: 392 Bytes

Contents

module Convert
  module Converters

    def gist(string, options = {})
      # https://gist.github.com/1710276

      # No options at the moment
      options = {}.merge(options)

      @regex = %r{https?://gist\.github\.com/(\w+/)?(\d+)}

      string.gsub(@regex) do
        gist_id = $2
        %{<script src="https://gist.github.com/#{gist_id}.js"></script>}
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
convert-0.1.7 lib/converters/gist.rb
convert-0.1.6 lib/converters/gist.rb
convert-0.1.5 lib/converters/gist.rb
convert-0.1.4 lib/converters/gist.rb
convert-0.1.3 lib/converters/gist.rb