ud 0.2.3 → 0.2.4
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ud.rb +10 -4
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d158caae202c27c348f980136587f9d4bc9f7c67
|
4
|
+
data.tar.gz: 2c11464fc90a9ce73392702794edb8ad4c38312d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2a50925ca0d07a417498deeda4d3056a1cb4e87f590707319331b9609f65c554c2c382b3ada0d30e8ff838ea02b55f5a1cc2a6fd606a629c30c6a6d921902e7
|
7
|
+
data.tar.gz: bd80e02b6430787d47be2893649d17447e3edae1aa947d3f324c92cb0c0fa788b28e73aefc778a0bfacf49c6af6ccb8da0b4107781195d45f35a249360f4aaf0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/ud.rb
CHANGED
@@ -13,16 +13,22 @@ module UD
|
|
13
13
|
|
14
14
|
# @return [String] the current gem's version
|
15
15
|
def version
|
16
|
-
'0.2.
|
16
|
+
'0.2.4'
|
17
17
|
end
|
18
18
|
|
19
19
|
# Get the search URL to query for a given term.
|
20
20
|
# @param term [String] the term to search for. It must be a string, spaces
|
21
21
|
# are allowed.
|
22
|
+
# @param api [Boolean] truthy if the API URL should be used.
|
22
23
|
# @return [String]
|
23
|
-
def search_url(term='')
|
24
|
+
def search_url(term='', api=true)
|
24
25
|
param = URI.encode_www_form('term' => term)
|
25
|
-
|
26
|
+
|
27
|
+
if api
|
28
|
+
"http://api.urbandictionary.com/v0/define?#{param}"
|
29
|
+
else
|
30
|
+
"http://www.urbandictionary.com/define.php?term=#{param}"
|
31
|
+
end
|
26
32
|
end
|
27
33
|
|
28
34
|
# Open the search URL in the user's browser
|
@@ -30,7 +36,7 @@ module UD
|
|
30
36
|
# are allowed.
|
31
37
|
# @return [Nil]
|
32
38
|
def open_url(term='')
|
33
|
-
system open_cmd, search_url(term)
|
39
|
+
system open_cmd, search_url(term, false)
|
34
40
|
end
|
35
41
|
|
36
42
|
# Query the website and return a list of definitions for the provided term.
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|