Sha256: 8a665f72b861d884c64f40d6e15c9aa375879e677ccc187027c7606a2b866605

Contents?: true

Size: 964 Bytes

Versions: 5

Compression:

Stored size: 964 Bytes

Contents

module RelatonOmg
  class OmgBibliographicItem < RelatonBib::BibliographicItem
    # @return [String, NilClass]
    class << self
      # @param file [String] path to YAML file
      # @return [RelatonOmg::OmgBibliographicItem]
      def from_yaml(file)
        from_hash YAML.load_file(file)
      end

      # @param hash [Hash]
      # @return [RelatonOmg::OmgBibliographicItem]
      def from_hash(hash)
        new RelatonOmg::HashConverter.hash_to_bib(hash)
      end

      # @param file [String] path to XML file
      # @return [RelatonOmg::OmgBibliographicItem]
      def from_xml(file)
        XMLParser.from_xml File.read file, encoding: "UTF-8"
      end
    end

    # @param opts [Hash]
    # @option opts [Nokogiri::XML::Builder] :builder XML builder
    # @option opts [Boolean] :bibdata
    # @option opts [String] :lang language
    # @return [String] XML
    def to_xml(**opts)
      opts[:date_format] ||= :short
      super
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
relaton-omg-1.7.0 lib/relaton_omg/omg_bibliographic_item.rb
relaton-omg-1.6.0 lib/relaton_omg/omg_bibliographic_item.rb
relaton-omg-1.6.pre1 lib/relaton_omg/omg_bibliographic_item.rb
relaton-omg-1.5.0 lib/relaton_omg/omg_bibliographic_item.rb
relaton-omg-1.5.pre lib/relaton_omg/omg_bibliographic_item.rb