Class: NEU::MODS::Document
- Inherits:
-
Object
- Object
- NEU::MODS::Document
- Includes:
- Builders, Projection, Selectors
- Defined in:
- lib/neu/mods/document.rb
Overview
The gem's main entry point: a thin facade over a parsed MODS document.
doc = NEU::MODS::Document.parse(xml)
doc.plain_title # => composed display title
doc.to_h # => full read projection
doc.primary_title_info # => a live Nokogiri node (for editing)
Selectors return live nodes (shared by read and write); projection methods
return plain data. Parsing uses &:noblanks to match Atlas's read and to
avoid spurious whitespace-only text nodes.
Constant Summary
Constants included from Projection
Constants included from Projection::Identifiers
Projection::Identifiers::RECORD_INFO_PARTS
Constants included from Projection::Support
Projection::Support::AUTHORITY_ATTRIBUTES
Constants included from Projection::RelatedItems
Projection::RelatedItems::NAMED_HOST_DETAIL_TYPES, Projection::RelatedItems::NAMED_RELATED_ITEM_TYPES
Constants included from Projection::OriginInfo
Projection::OriginInfo::MARC_COUNTRY_AUTHORITY
Constants included from Projection::Dates
Projection::Dates::DATE_ELEMENTS, Projection::Dates::DATE_FIELDS, Projection::Dates::DATE_FIELD_ROWS, Projection::Dates::DATE_KEYS, Projection::Dates::EMPTY_DATE, Projection::Dates::ISO8601_BASIC_DATE, Projection::Dates::ISO8601_ENCODING, Projection::Dates::W3CDTF_DATE
Constants included from Projection::Subjects
Projection::Subjects::HEADING_OMITTED_CHILDREN, Projection::Subjects::HEADING_SEPARATOR, Projection::Subjects::HIERARCHICAL_GEOGRAPHIC_LEVELS, Projection::Subjects::TYPELESS_NAME_SUBJECT_TYPE
Constants included from Projection::Titles
Projection::Titles::NON_SORT_BINDING, Projection::Titles::TITLE_SEPARATORS
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(nokogiri_doc) ⇒ Document
constructor
Wrap an already-parsed Nokogiri document (used by writers that own the doc they're mutating, so selectors and serialization share one instance).
- #to_xml ⇒ Object
Methods included from Projection
cardinality_of, compose_title, fold_type, join_non_sort, #to_h
Methods included from Projection::Identifiers
#classification, #identifiers, #location, #permanent_url, #permanent_url_display_label, #record_info
Methods included from Projection::RelatedItems
#host_collections, #related_items, #related_series
Methods included from Projection::PhysicalDescription
#digital_origin, #extent, #format, #genres, #notes, #physical_description_notes, #reformatting_quality, #resource_type, #table_of_contents, #target_audience
Methods included from Projection::OriginInfo
#edition, #frequency, #issuance, #origin_agents, #place_of_publication, #place_term_value, #publication_information
Methods included from Projection::Dates
#copyright_date_with_precision, #date_created_with_precision, #date_issued_with_precision
Methods included from Projection::Names
#alternative_names, #editable_corporate_creators, #editable_personal_creators, #name_entry, #names, #preserved_names
Methods included from Selectors
#abstract_nodes, #editable_creator_nodes, #keyword_subjects, #primary_title_info, #variant_title?
Methods included from Projection::Languages
Methods included from Projection::Subjects
#corporate_name_subjects, #genre_subjects, #geographic_code_subjects, #geographic_subjects, #hierarchical_geographic_subjects, #keywords, #map_data, #occupation_subjects, #personal_name_subjects, #subject_headings, #temporal_subjects, #title_subjects, #topical_subjects
Methods included from Projection::Titles
#abbreviated_title, #access_title_parts, #alternative_title, compose_title, join_non_sort, #main_title, #main_title_display_label, #plain_title, #title_parts, #translated_title, #uniform_title
Methods included from Projection::Access
#abstract, #abstract_display_label, #abstract_href, #access_condition, #access_condition_display_label, #access_condition_href, fold_type, #restriction_on_access, #restriction_on_access_display_label, #restriction_on_access_href, #use_and_reproduction, #use_and_reproduction_display_label, #use_and_reproduction_href
Methods included from Builders
#build_corporate_name, #build_node, #build_personal_name
Constructor Details
#initialize(nokogiri_doc) ⇒ Document
Wrap an already-parsed Nokogiri document (used by writers that own the doc they're mutating, so selectors and serialization share one instance).
34 35 36 |
# File 'lib/neu/mods/document.rb', line 34 def initialize(nokogiri_doc) @doc = nokogiri_doc end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
26 27 28 |
# File 'lib/neu/mods/document.rb', line 26 def doc @doc end |
Class Method Details
.parse(xml) ⇒ Object
28 29 30 |
# File 'lib/neu/mods/document.rb', line 28 def self.parse(xml) new(Nokogiri::XML(xml.to_s, &:noblanks)) end |
Instance Method Details
#to_xml ⇒ Object
38 39 40 |
# File 'lib/neu/mods/document.rb', line 38 def to_xml(...) doc.to_xml(...) end |