Module: Dspace::Builders::ModelBuilder

Defined in:
lib/dspace/builders/model_builder.rb

Class Method Summary collapse

Class Method Details

.build_bitstreams(bitstreams = []) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/dspace/builders/model_builder.rb', line 32

def self.build_bitstreams(bitstreams=[])
  return bitstreams unless bitstreams.is_a? Array
  colls = []
  bitstreams.each do |c|
    colls << Dspace::Bitstream.new(c)
  end
  colls
end

.build_collections(collections = []) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/dspace/builders/model_builder.rb', line 14

def self.build_collections(collections=[])
  return collections unless collections.is_a? Array
  colls = []
  collections.each do |c|
    colls << Dspace::Collection.new(c)
  end
  colls
end

.build_communities(communities = []) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/dspace/builders/model_builder.rb', line 5

def self.build_communities(communities=[])
  return communities unless communities.is_a? Array
  colls = []
  communities.each do |c|
    colls << Dspace::Community.new(c)
  end
  colls
end

.build_items(items = []) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/dspace/builders/model_builder.rb', line 23

def self.build_items(items=[])
  return items unless items.is_a? Array
  colls = []
  items.each do |c|
    colls << Dspace::Item.new(c)
  end
  colls
end

.build_metadatas(metadatas = []) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/dspace/builders/model_builder.rb', line 41

def self.build_metadatas(metadatas=[])
  return metadatas unless metadatas.is_a? Array
  colls = []
  metadatas.each do |c|
    colls << Dspace::Metadata.new(c)
  end
  colls
end

.build_policies(policies = []) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/dspace/builders/model_builder.rb', line 50

def self.build_policies(policies=[])
  return policies unless policies.is_a? Array
  colls = []
  policies.each do |c|
    colls << Dspace::Policy.new(c)
  end
  colls
end

.models2hash(list) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/dspace/builders/model_builder.rb', line 59

def self.models2hash(list)
  if list.is_a? Array
    list.map do |m|
      m.to_h
    end
  end
end