Class: NameSpotter
- Defined in:
- lib/name-spotter.rb,
lib/name-spotter/client.rb,
lib/name-spotter/scientific_name.rb,
lib/name-spotter/neti_neti_client.rb,
lib/name-spotter/taxon_finder_client.rb
Defined Under Namespace
Classes: Client, NetiNetiClient, ScientificName, TaxonFinderClient
Instance Method Summary collapse
- #find(input, format = nil) ⇒ Object
-
#initialize(client) ⇒ NameSpotter
constructor
A new instance of NameSpotter.
Constructor Details
#initialize(client) ⇒ NameSpotter
Returns a new instance of NameSpotter.
14 15 16 |
# File 'lib/name-spotter.rb', line 14 def initialize(client) @client = client end |
Instance Method Details
#find(input, format = nil) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/name-spotter.rb', line 18 def find(input, format = nil) text = to_text(input) names = @client.find(text) names = names.map{ |n| n.to_hash } return { names: names } unless format format == "json" ? to_json(names) : to_xml(names) end |