web-utils 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 012337d85ac2f57712f990bc66e4a1d17d3112d9
4
- data.tar.gz: 261669c70174e678cf1d8bea94150d42a8b10dc4
3
+ metadata.gz: 792776e1e1403fef198dc3ad45e8a7d8c59c8527
4
+ data.tar.gz: fbce05a63fad14ad5cd278a908e98f3cb4c7c59d
5
5
  SHA512:
6
- metadata.gz: f23190c3b3da2094b4de3e8162227d677a121c33c7851b1b044281b5897cafa50936382f80ab0d753fb19c014fd6053135e7913acba24b482ad71e459fabffdb
7
- data.tar.gz: b4679b9a9305809a82d96356fd429222bb364914eadfff14d73d6243973cf8f89a3fe74615ea8efc729e99b6ca8ee1cfc9fb6e21c17d5bc601358fd4183ab033
6
+ metadata.gz: f2a8bb1233d38fe0a1a4cdf36658c8b3c344c04e6deb3ad9673c14987cec56921b243a451abe0a263efb94fe517e63432de32dd2fddcabc2b4abc0d722b226b0
7
+ data.tar.gz: 6b5edcc51a47f8aec0bc9362d4ecdcd6265b47034bc23b8f511e65a9f76a5a2f8aea05b2b909fa276c6469bb2b3940feb12a9a28421bf6bc8e9487f0d509c9d9
data/README.md CHANGED
@@ -266,4 +266,8 @@ Just the usual shortcut for `Rack::Utils.escape_html`.
266
266
  Just the usual shortcut for `Rack::Utils.escape` for escaping
267
267
  what you want to put in a URL.
268
268
 
269
+ `google_maps_link(address)`
270
+ ---------------------------
271
+
272
+ Returns a google maps link with a marker at address passed as argument.
269
273
 
data/lib/web_utils.rb CHANGED
@@ -5,7 +5,7 @@ require 'uri'
5
5
 
6
6
  module WebUtils
7
7
 
8
- VERSION = '0.0.6'
8
+ VERSION = '0.1.0'
9
9
 
10
10
  # Most methods are supposed to be as simple as possible
11
11
  # and just cover most cases.
@@ -291,5 +291,10 @@ module WebUtils
291
291
  end
292
292
  module_function :u
293
293
 
294
+ def google_maps_link address
295
+ "https://www.google.com/maps/search/?api=1&query=#{u address}"
296
+ end
297
+ module_function :google_maps_link
298
+
294
299
  end
295
300
 
@@ -598,6 +598,11 @@ describe WebUtils do
598
598
  end
599
599
  end
600
600
 
601
+ describe '#google_maps_link' do
602
+ it 'Returns the URL with an escaped address' do
603
+ assert_equal 'https://www.google.com/maps/search/?api=1&query=42+Guide+Street%0AFlat+C%0AE8+4RL+London', utils.google_maps_link("42 Guide Street\nFlat C\nE8 4RL London")
604
+ end
605
+ end
601
606
 
602
607
  end
603
608
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mickael Riga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-28 00:00:00.000000000 Z
11
+ date: 2018-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack