class ActiveFedora::Orders::TargetProxy

Attributes

association[R]

Public Class Methods

new(association) click to toggle source
# File lib/active_fedora/orders/target_proxy.rb, line 6
def initialize(association)
  @association = association
end

Public Instance Methods

<<(obj) click to toggle source
# File lib/active_fedora/orders/target_proxy.rb, line 10
def <<(obj)
  association.append_target(obj)
  self
end
==(other) click to toggle source
Calls superclass method
# File lib/active_fedora/orders/target_proxy.rb, line 54
def ==(other)
  case other
  when TargetProxy
    super
  when Array
    to_a == other
  end
end
clear() click to toggle source
# File lib/active_fedora/orders/target_proxy.rb, line 45
def clear
  association.delete_at(0) while to_ary.present?
end
concat(objs) click to toggle source
# File lib/active_fedora/orders/target_proxy.rb, line 15
def concat(objs)
  objs.each do |obj|
    self.<<(obj)
  end
  self
end
delete(obj) click to toggle source

Deletes all items from self that are equal to obj. @param obj the object to remove from the list @return the last deleted item, or nil if no matching item is found

# File lib/active_fedora/orders/target_proxy.rb, line 41
def delete(obj)
  association.delete_target(obj)
end
delete_at(loc) click to toggle source

Deletes the element at the specified index, returning that element, or nil if the index is out of range.

# File lib/active_fedora/orders/target_proxy.rb, line 33
def delete_at(loc)
  result = association.delete_at(loc)
  result&.target
end
ids() click to toggle source
# File lib/active_fedora/orders/target_proxy.rb, line 27
def ids
  association.reader.map(&:target_id)
end
insert_at(loc, record) click to toggle source
# File lib/active_fedora/orders/target_proxy.rb, line 22
def insert_at(loc, record)
  association.insert_target_at(loc, record)
  self
end
to_a()
Alias for: to_ary
to_ary() click to toggle source
# File lib/active_fedora/orders/target_proxy.rb, line 49
def to_ary
  association.reader.map(&:target).dup
end
Also aliased as: to_a