Sha256: 8c194af10ef89270528de590b6ed31a5fdfb586214785c6766dd1e24543cc4cc

Contents?: true

Size: 313 Bytes

Versions: 2

Compression:

Stored size: 313 Bytes

Contents

require "clickable_link/version"
require "uri"

module ClickableLink
  
  def replace_to_uri(str)
    replace_str = str.dup
    uri_reg = URI.regexp(%w[http https])
    replace_str.gsub!(uri_reg) {%Q{<a href="#{$&}" target="_blank">#{$&}</a>}}
    return replace_str
  end

  module_function :replace_to_uri

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clickable_link-0.0.2 lib/clickable_link.rb
clickable_link-0.0.1 lib/clickable_link.rb