Module: Taxonifi::Splitter::Builder
- Defined in:
- lib/taxonifi/splitter/builder.rb
Overview
Builder functionality for parsing/lexing framework.
Class Method Summary collapse
-
.build_author_year(text) ⇒ Object
Build and return Taxonifi::Model::AuthorYear from a string.
-
.build_species_name(text) ⇒ Object
Build and return Taxonifi::Model::SpeciesName from a string.
Class Method Details
.build_author_year(text) ⇒ Object
Build and return Taxonifi::Model::AuthorYear from a string.
9 10 11 12 13 14 15 16 17 |
# File 'lib/taxonifi/splitter/builder.rb', line 9 def self.(text) text = text&.strip builder = Taxonifi::Model::AuthorYear.new return builder if text.nil? || text.empty? lexer = Taxonifi::Splitter::Lexer.new(text) Taxonifi::Splitter::Parser.new(lexer, builder). builder end |
.build_species_name(text) ⇒ Object
Build and return Taxonifi::Model::SpeciesName from a string.
20 21 22 23 24 25 |
# File 'lib/taxonifi/splitter/builder.rb', line 20 def self.build_species_name(text) lexer = Taxonifi::Splitter::Lexer.new(text, :species_name) builder = Taxonifi::Model::SpeciesName.new Taxonifi::Splitter::Parser.new(lexer, builder).parse_species_name builder end |