Module: ArcWeld::Relationships::CustomerOf

Defined in:
lib/arc_weld/relationships/customer_of.rb

Instance Method Summary collapse

Instance Method Details

#add_customer_resource(res) ⇒ Object



4
5
6
7
8
9
# File 'lib/arc_weld/relationships/customer_of.rb', line 4

def add_customer_resource(res)
  unless customer_of.include?(res)
    customer_of.push(res)
    res.add_customer(self)
  end
end

#add_customer_resources(*resources) ⇒ Object



11
12
13
# File 'lib/arc_weld/relationships/customer_of.rb', line 11

def add_customer_resources(*resources)
  resources.each { |res| add_customer_resource(res) }
end

#customer_of_relationshipObject



19
20
21
22
23
24
25
# File 'lib/arc_weld/relationships/customer_of.rb', line 19

def customer_of_relationship
  unless customer_of.empty?
    { 'customerOf' => {
        'list!' => related_customer_of_references
    }}
  end
end


15
16
17
# File 'lib/arc_weld/relationships/customer_of.rb', line 15

def related_customer_of_references
  (customer_of.map { |resource| resource.ref.render }).join
end