active-fedora 3.1.0.pre10 → 3.1.0.pre11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,7 +32,7 @@ module ActiveFedora
32
32
  def self.from_xml(xml, tmpl=nil)
33
33
  tmpl = self.new(nil, nil) if tmpl.nil? ## This path is used only for unit testing (e.g. MarpaDCDatastream.from_xml(fixture("data.xml")) )
34
34
 
35
- if xml.nil?
35
+ if !xml.present?
36
36
  tmpl.ng_xml = self.xml_template
37
37
  elsif xml.kind_of? Nokogiri::XML::Node || xml.kind_of?(Nokogiri::XML::Document)
38
38
  tmpl.ng_xml = xml
@@ -20,16 +20,14 @@ module ActiveFedora
20
20
  DCTERMS.each do |el|
21
21
  field el, :string, :multiple=>true
22
22
  end
23
- ###TODO this is loading eagerly, but we could make it lazy
24
- self.class.from_xml(content, self)
25
- self
23
+ self.class.from_xml(nil, self)
26
24
  end
27
25
 
28
26
  # Populate a QualifiedDublinCoreDatastream object based on the "datastream" node from a FOXML file
29
27
  # @param [String] node the xml from the content. Assumes that the content of this datastream is that of an ActiveFedora QualifiedDublinCoreDatastream
30
28
  # @param [ActiveFedora::Datastream] tmpl the Datastream object that you are building
31
29
  def self.from_xml(xml, tmpl) # :nodoc:
32
- return if xml.nil?
30
+ return if !xml.present?
33
31
  node = Nokogiri::XML::Document.parse(xml)
34
32
  tmpl.fields.each do |z|
35
33
  fname = z.first
@@ -47,9 +45,13 @@ module ActiveFedora
47
45
  tmpl
48
46
  end
49
47
 
50
- def to_xml()
51
- to_dc_xml()
52
- end
48
+ def to_xml()
49
+ to_dc_xml()
50
+ end
51
+
52
+ def self.xml_template
53
+ Nokogiri::XML::Document.parse("<dc xmlns:dcterms='http://purl.org/dc/terms/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'/>")
54
+ end
53
55
 
54
56
  #Render self as a Fedora DC xml document.
55
57
  def to_dc_xml
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "3.1.0.pre10"
2
+ VERSION = "3.1.0.pre11"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1923832013
4
+ hash: 1923832015
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
9
  - 0
10
10
  - pre
11
- - 10
12
- version: 3.1.0.pre10
11
+ - 11
12
+ version: 3.1.0.pre11
13
13
  platform: ruby
14
14
  authors:
15
15
  - Matt Zumwalt
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-10-20 00:00:00 -05:00
21
+ date: 2011-10-21 00:00:00 -05:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency