link_url 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/link_url.rb +25 -0
  3. metadata +43 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzQyNGI2NzhkOGM1YWUxNmMxNWUxZWIwMzNiNmZlNDRmNWRkYTViMw==
5
+ data.tar.gz: !binary |-
6
+ Mjk5NmIyMWU0ZTk0M2MwZjZkNDFjNjY4MmVmMzRkYzQwNDliMzA0NA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NDc4ZjZlMjE0MjI5YzZmNDA0M2QxZWFhOTczYjQ1NjIzYjdjNGU1MGQyZDVh
10
+ MGRjNGRjZTI3YmE2MGU2NDhhMmE4NzFlMTIzMmU4YjM0N2IyNzk2ZjNhY2My
11
+ NDRlMzYyNjY3ZWZiMmIxZjllMzE2YmMzNGRhYjE1OWY5NjkyY2M=
12
+ data.tar.gz: !binary |-
13
+ NjZjMmUwMjcyZWJiZWYwYjI0N2NhYmJmOGVmMDdkZGNkMDAxYTBmYWUzYjBh
14
+ NzAwNzAzNTJlNWIwZDE5MTZkNDg3OGQ4MTQ0YTJkYjA3MDU3ZmJmNTJlMWM5
15
+ YjQxNzAyMzBkZDI3ZjA5YmU3ZmIyNzY5ODc2YjY3MmNlNjFjMTY=
@@ -0,0 +1,25 @@
1
+ class LinkUrl
2
+ def self.convert(content)
3
+ if !content.gsub( %r{https://[^\s<]+} ).nil?
4
+ content.gsub( %r{http://[^\s<]+} ) do |url|
5
+ content = content.gsub(url,"<a href='"+url+"'>"+url+"</a>")
6
+ end
7
+ end
8
+ if !content.gsub( %r{https://[^\s<]+} ).nil?
9
+ content.gsub( %r{https://[^\s<]+} ) do |url|
10
+ content = content.gsub(url,"<a href='"+url+"'>"+url+"</a>")
11
+ end
12
+ end
13
+ if !content.gsub( %r{ www.[^\s<]+} ).nil?
14
+ content.gsub( %r{ www.[^\s<]+} ) do |url|
15
+ content = content.gsub(url," <a href='http://"+url.gsub(" ","")+"'>"+url.gsub(" ","")+"</a>")
16
+ end
17
+ end
18
+ if !content.gsub( %r{^\www.[^\s<]+} ).nil?
19
+ content.gsub( %r{^\www.[^\s<]+} ) do |url|
20
+ content = content.gsub(url,"<a href='http://"+url+"'>"+url+"</a>")
21
+ end
22
+ end
23
+ return content
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: link_url
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ashish Prajapati
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Convert url's from string into link as http://, https:// and www.
14
+ email: mail@ashishprajapati.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/link_url.rb
20
+ homepage: http://rubygems.org/gems/link_url
21
+ licenses: []
22
+ metadata: {}
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ requirements: []
38
+ rubyforge_project:
39
+ rubygems_version: 2.0.4
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Make all url into link
43
+ test_files: []