url_link 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 +7 -0
  2. data/lib/url_link.rb +25 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 17c8cd847f603e949a2092460bc26b7b684c3097
4
+ data.tar.gz: da9ce6715f5271546fe398fbd3e2a16bd3b968b2
5
+ SHA512:
6
+ metadata.gz: 7d4a98820c6b3e7ee8c966bf4fe29d03c9184e236e786f918ad95e464ae848e61cb3b4c34bb4fec723b73328e325f25de5ad381547f647a2619f3f813cdc9609
7
+ data.tar.gz: 289c13ca46c26c8c67d7089d3d8d380858f7a8b7055c9edfc489afcb33f4a1f32d24805ea869a792a5fb8f699376c2c9df23bce74db7024372b3cc7f2a7f120d
data/lib/url_link.rb ADDED
@@ -0,0 +1,25 @@
1
+ module UrlLink
2
+
3
+ class url_link
4
+
5
+ def self.format(url_link)
6
+ unless url_link.blank?
7
+ url_link.gsub( %r{(http|https)://[^\s<]+} ) do |url|
8
+ if url[/(?:png|jpe?g|gif|svg)$/]
9
+ "<img src='#{url}' />"
10
+ else
11
+ "<a href='#{url}' target='_blank'>#{url}</a> "
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ # def url_link(proper_url_link)
18
+ # unless html_format.blank?
19
+ # html_format.html_safe
20
+ # end
21
+ # end
22
+
23
+ end
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: url_link
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Marcelo Austria
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Convert all the urls from text or string to Url https://www.facebook.com/marcelo.austria.1
14
+ <a target="_blank" https://www.facebook.com/marcelo.austria.1">https://www.facebook.com/marcelo.austria.1</a>,
15
+ http://blogspot.com/images/screenshot.png <img src="http://blogspot.com/images/screenshot.png"/>")
16
+ email: marceloaustria@yahoo.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/url_link.rb
22
+ homepage: http://rubygems.org/gems/url_link
23
+ licenses: []
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.0.3
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Convert all url into link
45
+ test_files: []