Class: Cul::Scv::Hydra::Datastreams::ModsDocument
- Inherits:
-
ActiveFedora::OmDatastream
- Object
- ActiveFedora::OmDatastream
- Cul::Scv::Hydra::Datastreams::ModsDocument
- Includes:
- Solrizer::ScvModsFieldable, Solrizer::TerminologyBasedSolrizer, OM::XML::TerminologyBasedSolrizer
- Defined in:
- app/models/cul/scv/hydra/datastreams/mods_document.rb
Constant Summary
Constants included from Solrizer::ScvModsFieldable
Solrizer::ScvModsFieldable::MODS_NS
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Solrizer::ScvModsFieldable
#collections, #dates, #formats, #main_title, #mods, #names, normalize, #projects, #repositories, #shelf_locators, #sort_title, #titles, #to_solr, #zero_pad_year
Methods included from Solrizer::TerminologyBasedSolrizer
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'app/models/cul/scv/hydra/datastreams/mods_document.rb', line 147 def method_missing method, *args query = false _mname = method.id2name if _mname[-1,1] == '?' query = true _mname = _mname[0,_mname.length-1] end _msym = _mname.to_sym has_term = self.class.terminology.has_term?(_msym) return false if query and not has_term _r = super(_mname.to_sym, *args) if query _r.length > 0 else _r end end |
Class Method Details
.xml_template ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'app/models/cul/scv/hydra/datastreams/mods_document.rb', line 126 def self.xml_template builder = Nokogiri::XML::Builder.new do |xml| xml.mods(:version=>"3.4", "xmlns"=>"http://www.loc.gov/mods/v3", "xmlns:xlink"=>"http://www.w3.org/1999/xlink", "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance"){ } end builder.doc.encoding = 'UTF-8' # for some reason, this is the only way to get an equivalent nokogiri root node; the attribute can't be in the original builder call builder.doc.root["xsi:schemaLocation"] = 'http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-4.xsd' return builder.doc end |
Instance Method Details
#prefix ⇒ Object
140 141 142 143 144 145 |
# File 'app/models/cul/scv/hydra/datastreams/mods_document.rb', line 140 def prefix if ::ActiveFedora::VERSION >= '8' Rails.logger.warn("the prefix method of #{self.class.name} was overriden to maintain backwards compatibility") end '' end |