ud 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/ud.rb +10 -4
  5. metadata +1 -1
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ccafe9c95f63045cc15ddbb317cb7c2342cbeba
4
- data.tar.gz: e3c9bf16950fbcbff3b79be88697fe87f247861b
3
+ metadata.gz: d158caae202c27c348f980136587f9d4bc9f7c67
4
+ data.tar.gz: 2c11464fc90a9ce73392702794edb8ad4c38312d
5
5
  SHA512:
6
- metadata.gz: 99c89f5c0fdbd53c2c3e4da643b12ad54f90a7f0227897e5923050506cd16635f448788c828aa30b5c4559f84869daaae42bf0b6e01c00d5f97a7ee29b15644b
7
- data.tar.gz: 0dd857c47767eb40371d75056def0eac0325010eba4c1294dbffdedbe4834321dde05cae18420c9ea80a489df22aa5cffc5544ecc4db55cd0d23955ebe5e8a69
6
+ metadata.gz: d2a50925ca0d07a417498deeda4d3056a1cb4e87f590707319331b9609f65c554c2c382b3ada0d30e8ff838ea02b55f5a1cc2a6fd606a629c30c6a6d921902e7
7
+ data.tar.gz: bd80e02b6430787d47be2893649d17447e3edae1aa947d3f324c92cb0c0fa788b28e73aefc778a0bfacf49c6af6ccb8da0b4107781195d45f35a249360f4aaf0
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.3'
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
- "http://api.urbandictionary.com/v0/define?#{param}"
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baptiste Fontaine
metadata.gz.sig CHANGED
Binary file