Module: Taxa::OpenTreeOfLife::LabelFormatHelper
- Included in:
- Taxonomy, TreeOfLife
- Defined in:
- lib/taxa/open_tree_of_life/label_format_helper.rb
Overview
helper module to get label format from parameters
Constant Summary collapse
- SUBTREE_LABEL_FORMATS =
%w[name id name_and_id].freeze
Instance Method Summary collapse
Instance Method Details
#get_label_format(format, **parameters) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/taxa/open_tree_of_life/label_format_helper.rb', line 9 def get_label_format(format, **parameters) if format == 'newick' label_format = parameters[:label_format] || 'name_and_id' unless SUBTREE_LABEL_FORMATS.include?(label_format) raise ArgumentError, "label_format be one of the following #{SUBTREE_LABEL_FORMATS.join(', ')}" end return label_format end nil end |