oald_parser 0.1.6 → 0.1.7

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.
data/README.rdoc ADDED
@@ -0,0 +1,40 @@
1
+ = Oald Parser
2
+
3
+ == Description
4
+
5
+ OaldParser is a simple gem for getting descriptions for words.
6
+ It uses online Oxford Advanced Learner's Dictionary for this purpose.
7
+
8
+ == Installation
9
+
10
+ gem install oald_parser
11
+
12
+ == Usage
13
+
14
+ The whole gem is hidden by a facade class that should be used
15
+ for getting all the information.
16
+ The first way to create this facade is:
17
+
18
+ facade = OaldParser::Facade.create_facade
19
+
20
+ After that it can be used in such a way:
21
+
22
+ text = facade.describe(word: 'dog') OR
23
+ text = facade.describe(str: 'a dog [CN]')
24
+
25
+ The 'describe' method returns a plain text describing word or a string.
26
+
27
+ == Customizing
28
+
29
+ If you want to customize the facade you should look at the 'create_facade' method:
30
+
31
+ def self.create_facade
32
+ downloader = PageDownloader.new('http://www.oup.com/oald-bin/web_getald7index1a.pl')
33
+ parser = PageParser.new
34
+ formatter = Formatter.new(lines: 15)
35
+ extractor = WordExtractor.new
36
+ Facade.new(downloader, parser, formatter, extractor)
37
+ end
38
+
39
+ As you can see it is not a problem to use your own parser or formatter and create
40
+ a special instance of facade.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'spec/rake/spectask'
2
+
3
+ desc "Run all specs"
4
+ Spec::Rake::SpecTask.new('spec') do |t|
5
+ t.spec_files = FileList['spec/**/*.rb']
6
+ end
@@ -9,8 +9,9 @@ module OaldParser
9
9
 
10
10
  def download(word)
11
11
  url = URI.parse(@url)
12
- Net::HTTP.get(url + "?search_word=#{word}")
13
- rescue
12
+ Net::HTTP.post(url, "search_word=#{word}")
13
+ rescue Exception => e
14
+ puts e.inspect
14
15
  nil
15
16
  end
16
17
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Victor Savkin
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-14 00:00:00 +11:00
17
+ date: 2010-05-10 00:00:00 +11:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -58,6 +58,8 @@ files:
58
58
  - lib/oald_parser/facade.rb
59
59
  - lib/oald_parser/word_extractor.rb
60
60
  - lib/oald_parser.rb
61
+ - README.rdoc
62
+ - Rakefile
61
63
  has_rdoc: true
62
64
  homepage:
63
65
  licenses: []