Module: Relaton::Cli
- Defined in:
- lib/relaton-cli.rb,
lib/relaton/cli.rb,
lib/relaton/cli/command.rb,
lib/relaton/cli/version.rb,
lib/relaton/cli/relaton_file.rb,
lib/relaton/cli/xml_convertor.rb,
lib/relaton/cli/base_convertor.rb,
lib/relaton/cli/yaml_convertor.rb,
lib/relaton/cli/xml_to_html_renderer.rb,
lib/relaton/cli/subcommand_collection.rb
Defined Under Namespace
Classes: BaseConvertor, Command, RelatonDb, RelatonFile, SubcommandCollection, XMLConvertor, XmlToHtmlRenderer, YAMLConvertor
Constant Summary collapse
- VERSION =
"1.6.0".freeze
Class Method Summary collapse
- .parse_xml(doc) ⇒ RelatonBib::BibliographicItem, RelatonIsoBib::IsoBibliongraphicItem
- .processor(doc) ⇒ RelatonIso::Processor, ...
-
.relaton ⇒ Object
Relaton.
- .start(arguments) ⇒ Object
Class Method Details
.parse_xml(doc) ⇒ RelatonBib::BibliographicItem, RelatonIsoBib::IsoBibliongraphicItem
38 39 40 41 42 43 44 |
# File 'lib/relaton/cli.rb', line 38 def parse_xml(doc) if (proc = Cli.processor(doc)) proc.from_xml(doc.to_s) else RelatonBib::XMLParser.from_xml(doc.to_s) end end |
.processor(doc) ⇒ RelatonIso::Processor, ...
51 52 53 54 55 56 57 |
# File 'lib/relaton/cli.rb', line 51 def processor(doc) docid = doc.at "docidentifier" proc = get_proc docid return proc if proc Relaton::Registry.instance.by_type(docid&.text&.match(/^\w+/)&.to_s) end |
.relaton ⇒ Object
Relaton
Based on current setup, we need to initiate a Db instance to register all of it’s supported processor backends. To make it easier we have added it as a class method so we can use this whenever necessary.
31 32 33 |
# File 'lib/relaton/cli.rb', line 31 def relaton RelatonDb.instance.db end |