web-utils 0.0.6 → 0.1.0
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.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/web_utils.rb +6 -1
- data/test/test_web_utils.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 792776e1e1403fef198dc3ad45e8a7d8c59c8527
|
|
4
|
+
data.tar.gz: fbce05a63fad14ad5cd278a908e98f3cb4c7c59d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
|
data/test/test_web_utils.rb
CHANGED
|
@@ -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
|
|
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-
|
|
11
|
+
date: 2018-07-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|