Class: Cul::Hydra::Datastreams::DCMetadata
- Inherits:
-
ActiveFedora::OmDatastream
- Object
- ActiveFedora::OmDatastream
- Cul::Hydra::Datastreams::DCMetadata
show all
- Defined in:
- app/models/cul/hydra/datastreams/dc_metadata.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
|
# File 'app/models/cul/hydra/datastreams/dc_metadata.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
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
61
62
63
64
65
66
67
68
69
70
71
|
# File 'app/models/cul/hydra/datastreams/dc_metadata.rb', line 61
def self.xml_template
Nokogiri::XML::Document.parse(<<-src
<oai_dc:dc
xmlns:oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc/'
xmlns:dc='http://purl.org/dc/elements/1.1/'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'></oai_dc:dc>
src
)
end
|
Instance Method Details
#action_after_save ⇒ Object
Because FCRepo 3.5+ modifies DC on saves (to ensure that PID is a dc:identifier value), this datastream’s content must be reloaded after saves
74
75
76
77
78
|
# File 'app/models/cul/hydra/datastreams/dc_metadata.rb', line 74
def action_after_save
@content = nil
@ng_xml = nil
remove_instance_variable(:@ng_xml)
end
|
#prefix ⇒ Object
80
81
82
83
84
85
|
# File 'app/models/cul/hydra/datastreams/dc_metadata.rb', line 80
def prefix
''
end
|