Class: IMS::CC::Organizations::Item

Inherits:
Object
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/ims/cc/organizations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resourceObject

Returns the value of attribute resource.



7
8
9
# File 'lib/ims/cc/organizations.rb', line 7

def resource
  @resource
end

Instance Method Details

#all_items(res = []) ⇒ Object



35
36
37
38
39
# File 'lib/ims/cc/organizations.rb', line 35

def all_items(res=[])
  res << self
  items.each{|i|i.all_items(res)}
  res
end

#attach_resources(resources) ⇒ Object



30
31
32
33
# File 'lib/ims/cc/organizations.rb', line 30

def attach_resources(resources)
  @resource = resources.find_by_identifier(identifierref) if identifierref
  items.each { |i| i.attach_resources(resources) }
end

#find_by_identifier(id) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ims/cc/organizations.rb', line 18

def find_by_identifier(id)
  if id == identifier
    self
  else
    items.each do |i|
      if item = i.find_by_identifier(id)
        return item
      end
    end
  end
end