Class: RelatonOmg::OmgBibliographicItem
- Inherits:
-
RelatonBib::BibliographicItem
- Object
- RelatonBib::BibliographicItem
- RelatonOmg::OmgBibliographicItem
- Defined in:
- lib/relaton_omg/omg_bibliographic_item.rb
Class Method Summary collapse
- .from_hash(hash) ⇒ RelatonOmg::OmgBibliographicItem
- .from_xml(file) ⇒ RelatonOmg::OmgBibliographicItem
- .from_yaml(file) ⇒ RelatonOmg::OmgBibliographicItem
Instance Method Summary collapse
-
#ext_schema ⇒ String
Fetches flavor shcema version from XML.
-
#to_xml(**opts) ⇒ String
XML.
Class Method Details
.from_hash(hash) ⇒ RelatonOmg::OmgBibliographicItem
13 14 15 16 |
# File 'lib/relaton_omg/omg_bibliographic_item.rb', line 13 def from_hash(hash) bib_hash = RelatonOmg::HashConverter.hash_to_bib(hash) new(**bib_hash) end |
.from_xml(file) ⇒ RelatonOmg::OmgBibliographicItem
20 21 22 |
# File 'lib/relaton_omg/omg_bibliographic_item.rb', line 20 def from_xml(file) XMLParser.from_xml File.read file, encoding: "UTF-8" end |
.from_yaml(file) ⇒ RelatonOmg::OmgBibliographicItem
7 8 9 |
# File 'lib/relaton_omg/omg_bibliographic_item.rb', line 7 def from_yaml(file) from_hash YAML.load_file(file) end |
Instance Method Details
#ext_schema ⇒ String
Fetches flavor shcema version from XML
30 31 32 |
# File 'lib/relaton_omg/omg_bibliographic_item.rb', line 30 def ext_schema @ext_schema ||= schema_versions["relaton-model-omg"] end |
#to_xml(**opts) ⇒ String
Returns XML.
39 40 41 42 |
# File 'lib/relaton_omg/omg_bibliographic_item.rb', line 39 def to_xml(**opts) opts[:date_format] ||= :short super end |