oxforddictionaries 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -2
- data/lib/oxforddictionaries.rb +0 -5
- data/lib/oxforddictionaries/parser.rb +6 -4
- data/lib/oxforddictionaries/version.rb +2 -1
- data/oxforddictionaries.gemspec +7 -5
- data/spec/oxforddictionaries/parser_spec.rb +15 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d6f398d10537f80be81395b4aad03fb1b1f58d9
|
4
|
+
data.tar.gz: 54f779d2b379767d63bb42b3768a434278911e52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf8a92673b3ab9893e07d862785017b984fc43b10f463852b545dff1290b1963157f97705c7c9476350d16034f45e2faaeb4343f799e189f23e0e8c980352949
|
7
|
+
data.tar.gz: 7821848a03d61dfdd8698b675a4e95b1aeb4586bd0b9369904b934a8b1369bc80e770fabd17307dc18378acfb8bd60db77cc034799fb48940666a4af6c3ca138
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
data/lib/oxforddictionaries.rb
CHANGED
@@ -8,11 +8,13 @@ module Oxforddictionaries
|
|
8
8
|
attr_reader :word
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
@word = ''
|
11
|
+
@word, @html, @page = '', '', nil
|
12
12
|
end
|
13
13
|
|
14
14
|
def exist?
|
15
|
-
|
15
|
+
first = !(regex =~ single_match).nil?
|
16
|
+
second = !(regex =~ plural_matches).nil?
|
17
|
+
(first || second)
|
16
18
|
end
|
17
19
|
|
18
20
|
def word=(text)
|
@@ -38,8 +40,8 @@ module Oxforddictionaries
|
|
38
40
|
end
|
39
41
|
|
40
42
|
def single_match
|
41
|
-
|
42
|
-
|
43
|
+
tag = @page.search('h1').first
|
44
|
+
tag && tag.text
|
43
45
|
end
|
44
46
|
|
45
47
|
def plural_matches
|
data/oxforddictionaries.gemspec
CHANGED
@@ -6,22 +6,24 @@ require 'oxforddictionaries/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'oxforddictionaries'
|
8
8
|
spec.version = Oxforddictionaries::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
|
9
|
+
spec.authors = [
|
10
|
+
'Michał Skóra', 'Agnieszka Matysek', 'Alek Malaszkiewicz'
|
11
|
+
]
|
12
|
+
spec.email = %w(info@fractalsoft.org)
|
11
13
|
spec.summary = 'Oxford Dictionaries'
|
12
14
|
spec.description = 'Simple parser to english words'
|
13
15
|
spec.homepage = ''
|
14
16
|
spec.license = 'MIT'
|
15
17
|
|
16
18
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(
|
18
|
-
spec.test_files = spec.files.grep(
|
19
|
+
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(/^spec/)
|
19
21
|
spec.require_paths = ['lib']
|
20
22
|
|
21
23
|
spec.add_dependency 'nokogiri', '~> 1.6'
|
22
24
|
|
23
25
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
24
|
-
spec.add_development_dependency 'rake', '
|
26
|
+
spec.add_development_dependency 'rake', '>= 10.4'
|
25
27
|
spec.add_development_dependency 'rspec', '~> 3.3'
|
26
28
|
spec.add_development_dependency 'webmock', '~> 1.21'
|
27
29
|
end
|
@@ -35,6 +35,21 @@ describe Oxforddictionaries::Parser do
|
|
35
35
|
subject.word = 'fish'
|
36
36
|
expect(subject).to be_exist
|
37
37
|
end
|
38
|
+
|
39
|
+
it 'if word is home' do
|
40
|
+
subject.word = 'home'
|
41
|
+
expect(subject).to be_exist
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'if word is dive' do
|
45
|
+
subject.word = 'dive'
|
46
|
+
expect(subject).to be_exist
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'if word is doom' do
|
50
|
+
subject.word = 'doom'
|
51
|
+
expect(subject).to be_exist
|
52
|
+
end
|
38
53
|
end
|
39
54
|
|
40
55
|
context 'false' do
|
metadata
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oxforddictionaries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michał Skóra
|
8
|
+
- Agnieszka Matysek
|
9
|
+
- Alek Malaszkiewicz
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
13
|
+
date: 2015-06-30 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: nokogiri
|
@@ -42,16 +44,16 @@ dependencies:
|
|
42
44
|
name: rake
|
43
45
|
requirement: !ruby/object:Gem::Requirement
|
44
46
|
requirements:
|
45
|
-
- - "
|
47
|
+
- - ">="
|
46
48
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
49
|
+
version: '10.4'
|
48
50
|
type: :development
|
49
51
|
prerelease: false
|
50
52
|
version_requirements: !ruby/object:Gem::Requirement
|
51
53
|
requirements:
|
52
|
-
- - "
|
54
|
+
- - ">="
|
53
55
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
56
|
+
version: '10.4'
|
55
57
|
- !ruby/object:Gem::Dependency
|
56
58
|
name: rspec
|
57
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +84,7 @@ dependencies:
|
|
82
84
|
version: '1.21'
|
83
85
|
description: Simple parser to english words
|
84
86
|
email:
|
85
|
-
-
|
87
|
+
- info@fractalsoft.org
|
86
88
|
executables: []
|
87
89
|
extensions: []
|
88
90
|
extra_rdoc_files: []
|