Class: ParsleyStore
- Inherits:
-
Object
- Object
- ParsleyStore
- Defined in:
- lib/parsley-store.rb,
lib/parsley-store/version.rb
Constant Summary collapse
- LOCAL =
database numbers for Redis
1- SLAVE =
2- VERSION =
'0.3.4'
Instance Method Summary collapse
-
#initialize(local_db = LOCAL, slave_db = SLAVE) ⇒ ParsleyStore
constructor
A new instance of ParsleyStore.
- #parse(scientific_name, opts = {}) ⇒ Object
Constructor Details
#initialize(local_db = LOCAL, slave_db = SLAVE) ⇒ ParsleyStore
Returns a new instance of ParsleyStore.
14 15 16 17 18 |
# File 'lib/parsley-store.rb', line 14 def initialize(local_db = LOCAL, slave_db = SLAVE) @parser = ScientificNameParser.new @local = Redis.new @local.select(local_db) end |
Instance Method Details
#parse(scientific_name, opts = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/parsley-store.rb', line 20 def parse(scientific_name, opts = {}) @canonical_only = !!opts[:canonical_only] @scientific_name = scientific_name parsed_data = get_redis_data return parsed_data if parsed_data cache_parsed_data(parse_scientific_name) end |