Class: RTunesU::HasNEntityCollectionProxy

Inherits:
SubentityAssociationProxy show all
Defined in:
lib/rtunesu/associations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SubentityAssociationProxy

#initialize

Constructor Details

This class inherits a constructor from RTunesU::SubentityAssociationProxy

Instance Attribute Details

#editsObject (readonly)

Returns the value of attribute edits.



36
37
38
# File 'lib/rtunesu/associations.rb', line 36

def edits
  @edits
end

#targetObject (readonly)

Returns the value of attribute target.



36
37
38
# File 'lib/rtunesu/associations.rb', line 36

def target
  @target
end

Instance Method Details

#<<(entity) ⇒ Object



50
51
52
53
# File 'lib/rtunesu/associations.rb', line 50

def <<(entity)
  @target << entity
  @edits  << entity
end

#[]=(index, entity) ⇒ Object



55
56
57
58
# File 'lib/rtunesu/associations.rb', line 55

def []=(index,entity)
  @target[index] = entity
  @entity[index] = entity
end

#from_xml(name) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/rtunesu/associations.rb', line 38

def from_xml(name)
  if @source_xml
   @target = @source_xml.collect {|el| "RTunesU::#{name}".constantize.new(:source_xml => el, :parent_handle => @owner.handle)}
  else
   @target = []
  end
end

#to_xml(builder) ⇒ Object



46
47
48
# File 'lib/rtunesu/associations.rb', line 46

def to_xml(builder)
  self.edits.each {|entity| entity.to_xml(builder)}
end