Module: ASpaceImport::XML::DOM::ClassMethods

Defined in:
backend/app/converters/lib/xml_dom.rb

Instance Method Summary collapse

Instance Method Details

#configObject



18
19
20
# File 'backend/app/converters/lib/xml_dom.rb', line 18

def config
  @config
end

#configure {|@config| ... } ⇒ Object

Yields:



12
13
14
15
# File 'backend/app/converters/lib/xml_dom.rb', line 12

def configure
  @config ||= Config.new
  yield @config
end

#make(type) {|ASpaceImport::JSONModel(type)| ... } ⇒ Object

Yields:

  • (ASpaceImport::JSONModel(type))


23
24
25
# File 'backend/app/converters/lib/xml_dom.rb', line 23

def make(type)
  yield ASpaceImport::JSONModel(type).new
end

#mix(hash1, hash2, hash3 = nil) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'backend/app/converters/lib/xml_dom.rb', line 28

def mix(hash1, hash2, hash3=nil)
  if hash3
    hash2 = mix(hash2, hash3)
  end
  hash1.merge(hash2) do |key, one, two|
    if one.is_a?(Hash) && two.is_a?(Hash)
      mix(one, two)
    elsif one.is_a?(Proc) && two.is_a?(Proc)
      [one, two]
    elsif one.is_a?(Array) && two.is_a?(Proc)
      one << two
    else
      two
    end
  end
end