lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.9.10 vs lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.9.11
- old
+ new
@@ -70,25 +70,15 @@
@vernacular_name_strings[name_string] = 1
end
end
def name_strings(opts = {})
- opts = { with_hash: false }.merge(opts)
- if !!opts[:with_hash]
- @name_strings
- else
- @name_strings.keys
- end
+ process_strings(@name_strings, opts)
end
def vernacular_name_strings(opts = {})
- opts = { with_hash: false }.merge(opts)
- if !!opts[:with_hash]
- @vernacular_name_strings
- else
- @vernacular_name_strings.keys
- end
+ process_strings(@vernacular_name_strings, opts)
end
def normalize(opts = {})
opts = { :with_canonical_names => true,
:with_extensions => true }.merge(opts)
@@ -107,9 +97,18 @@
end
@normalized_data
end
private
+
+ def process_strings(strings, opts)
+ opts = { with_hash: false }.merge(opts)
+ if !!opts[:with_hash]
+ strings
+ else
+ strings.keys
+ end
+ end
def get_canonical_name(a_scientific_name)
if @with_canonical_names
canonical_name = @parser.parse(a_scientific_name,
:canonical_only => true)