Class: Cul::Hydra::Datastreams::ModsDocument
- Inherits:
-
ActiveFedora::OmDatastream
- Object
- ActiveFedora::OmDatastream
- Cul::Hydra::Datastreams::ModsDocument
- Includes:
- Solrizer::ModsFieldable, Solrizer::TerminologyBasedSolrizer, OM::XML::TerminologyBasedSolrizer
- Defined in:
- app/models/cul/hydra/datastreams/mods_document.rb
Direct Known Subclasses
Constant Summary
Constants included from Solrizer::ModsFieldable
Solrizer::ModsFieldable::MODS_NS
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Solrizer::ModsFieldable
#all_subjects, #alternative_titles, #collections, #coordinates, #date_notes, #date_range_to_textual_date, #dates, #formats, #item_in_context_url, #main_title, #mods, #names, #non_date_notes, #non_item_in_context_url, #origin_info_place, #origin_info_place_for_display, #project_url, #projects, #repository_code, #repository_text, #shelf_locators, #sort_title, #textual_dates, #titles, #to_solr, #translate_project_title, #translate_repo_marc_code, #zero_pad_year
Methods included from Solrizer::ModsFieldable::ClassMethods
#map_field, #map_value, #maps_field?, #normalize, #value_mapper
Methods included from Solrizer::TerminologyBasedSolrizer
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'app/models/cul/hydra/datastreams/mods_document.rb', line 175 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
154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'app/models/cul/hydra/datastreams/mods_document.rb', line 154 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
168 169 170 171 172 173 |
# File 'app/models/cul/hydra/datastreams/mods_document.rb', line 168 def prefix #if ::ActiveFedora::VERSION >= '8' # Rails.logger.warn("the prefix method of #{self.class.name} was overriden to maintain backwards compatibility") #end '' end |