parsley-store 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/parsley-store.rb +1 -1
  3. metadata +4 -5
  4. data/// +0 -42
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -45,7 +45,7 @@ class ParsleyStore
45
45
  @parser.parse(@scientific_name)
46
46
  rescue
47
47
  @parser = ScientificNameParser.new
48
- @parser.parse(@scientific_name)
48
+ @parser.parse(@scientific_name) rescue {:scientificName => {:parsed => false, :parser_version => ScientificNameParser::VERSION, :anonical => nil, :verbatim => @scientific_name}}
49
49
  end
50
50
  end
51
51
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsley-store
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dmitry Mozzherin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-05 00:00:00 -04:00
18
+ date: 2010-11-06 00:00:00 -04:00
19
19
  default_executable: parsley-store
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -92,7 +92,6 @@ files:
92
92
  - README.rdoc
93
93
  - Rakefile
94
94
  - VERSION
95
- - \
96
95
  - bin/parsley-store
97
96
  - features/parsley-store.feature
98
97
  - features/step_definitions/parsley-store_steps.rb
data/// DELETED
@@ -1,42 +0,0 @@
1
- require 'redis'
2
- require 'biodiversity'
3
-
4
-
5
- class ParsleyStore
6
- #database numbers for Redis
7
- LOCAL = 1
8
- SLAVE = 2
9
-
10
- def initialize(local_db = LOCAL, slave_db = SLAVE, opts)
11
- @parser = ScientificNameParser.new
12
- @local = Redis.new
13
- @local.select(local_db)
14
- @canonical_only = !!opts[:canonical_only]
15
- # slave replication is not set up yet, so I comment it out
16
- # @slave = Redis.new
17
- # @slave.select(slave_db)
18
- end
19
-
20
- def parse(scientific_name)
21
- stored = @local.get(scientific_name)
22
- return JSON.parse(stored, :symbolize_names => true) if stored
23
-
24
- begin
25
- parsed = @parser.parse(scientific_name)
26
- rescue
27
- @parser = ScientificNameParser.new
28
- parsed = @parser.parse(scientific_name)
29
- end
30
-
31
- if @canonical_only
32
- @local.hset scientific_name, 'parsed', parsed[:scientificName][:parsed]
33
- @local.hset scientific_name, 'parser_version', parsed[:scientificName][:parser_version]
34
- @local.hset scientific_name, 'canonical', parsed[:scientificName][:canonical]
35
- parsed[:scientificName][:canonical]
36
- else
37
- serialized = parsed.to_json
38
- @local.set scientific_name, serialized
39
- parsed
40
- end
41
- end
42
- end