Class: Cul::Hydra::Om::StandardMods
- Inherits:
-
ActiveFedora::OmDatastream
- Object
- ActiveFedora::OmDatastream
- Cul::Hydra::Om::StandardMods
show all
- Defined in:
- lib/cul_hydra/om/standard_mods.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/cul_hydra/om/standard_mods.rb', line 87
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
begin
has_term = self.class.terminology.has_term?(_msym)
_r = (has_term)? find_by_terms(_msym, *args) : nil
if query
return !( _r.nil? || _r.size()==0)
else
return _r
end
rescue
super
end
end
|
Class Method Details
.xml_template ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/cul_hydra/om/standard_mods.rb', line 68
def self.xml_template
builder = Nokogiri::XML::Builder.new do |xml|
xml.mods(:version=>"3.4",
"xmlns"=>"http://www.loc.gov/mods/v3",
"xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance"){
}
end
builder.doc.encoding = 'UTF-8'
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
80
81
82
83
84
85
|
# File 'lib/cul_hydra/om/standard_mods.rb', line 80
def prefix
''
end
|
#update_values(params) ⇒ Object
108
109
110
111
|
# File 'lib/cul_hydra/om/standard_mods.rb', line 108
def update_values(params)
super
self.dirty = true
end
|