class ActiveZuora::CollectionProxy
Attributes
records[R]
zobject_class[R]
Public Class Methods
new(ary = [])
click to toggle source
# File lib/active_zuora/collection_proxy.rb, line 10 def initialize(ary = []) unless ary.empty? raise "objects in collection must be ActiveZuora object instances" unless class_names = ary.map{|object| object.zuora_object_name}.uniq raise "objects in collection must be ActiveZuora object instances of the same class" unless class_names.length == 1 @zobject_class = class_names.first end @records = ary end
Public Instance Methods
add(object)
click to toggle source
# File lib/active_zuora/collection_proxy.rb, line 19 def add object raise "object must be an ActiveZuora object instance" unless object.zuora_object_name if records.empty? @zobject_class = object.zuora_object_name else raise "object must be must be ActiveZuora object instances of the same class as other elements in the Collection" unless object.zuora_object_name == zobject_class end @records.push object end
each() { |r| ... }
click to toggle source
# File lib/active_zuora/collection_proxy.rb, line 29 def each records.each { |r| yield r } end
empty?()
click to toggle source
# File lib/active_zuora/collection_proxy.rb, line 33 def empty? records.empty? end