dict 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/wiktionary.rb +11 -3
  2. metadata +10 -10
data/lib/wiktionary.rb CHANGED
@@ -8,18 +8,26 @@ class Wiktionary
8
8
  WIKI_URL = "http://en.wiktionary.org/wiki/"
9
9
  def initialize(word)
10
10
  if word.empty? then raise ArgumentError, "No word given." end
11
+ check_arguments
12
+
13
+ initialize_instance_arguments
14
+
11
15
  escaped_word = word.downcase.tr(' ', '_')
12
16
  @result = Result.new(escaped_word)
13
17
  @uri = URI(URI.escape(WIKI_URL + escaped_word))
14
18
  end
15
19
 
20
+
21
+ def check_arguments(word)
22
+
23
+ end
16
24
  #
17
25
  # Method returns an Result Object containing given word, translations, word usage examples.
18
26
  # Usage example:
19
27
  # result = Wiktionary.new("samochód").translate
20
28
  # result.term # => "samochód"
21
- # result.translations # => ["car","automobile"]
22
- # result.examples # => ["She drove her car to the mall.","The conductor linked the cars to the locomotive.", ...]
29
+ # result.translations # => {"samochód"=>["car", "automobile"]}
30
+ # result.examples # => {"samochód"=>["She drove her car to the mall.", "The conductor linked the cars to the locomotive.", "The 11:10 to London was operated by a 4-car diesel multiple unit", "From the front-most car of the subway, he filmed the progress through the tunnel.", "We ordered five hundred cars of gypsum.", ...]}
23
31
  #
24
32
  def translate
25
33
  req = Net::HTTP::Get.new(@uri.path)
@@ -48,7 +56,7 @@ class Wiktionary
48
56
  end
49
57
  end
50
58
  end
51
-
59
+
52
60
  @result
53
61
  end
54
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dict
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,40 +12,40 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-07-05 00:00:00.000000000 Z
15
+ date: 2012-07-06 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: slop
19
19
  requirement: !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
- - - ! '>='
22
+ - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: '0'
24
+ version: 3.3.2
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
- - - ! '>='
30
+ - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: 3.3.2
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: nokogiri
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  none: false
37
37
  requirements:
38
- - - ! '>='
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 1.5.5
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  none: false
45
45
  requirements:
46
- - - ! '>='
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
48
+ version: 1.5.5
49
49
  description: ! " Dict is a client of API which you lets you use multiple dictionaries.\n
50
50
  \ Dict is an open source project.\n"
51
51
  email: