Sha256: 86e1ebdc146db545faf44f679de64d927bdf0ce0764e0aed99eb023ffb3b612d
Contents?: true
Size: 897 Bytes
Versions: 1
Compression:
Stored size: 897 Bytes
Contents
# Represents a collection of IIS configuration objects. class IisObjectCollection def initialize element, item_name, type, add_callback = nil @collection_element = element @item_name = item_name @type = type @add_callback = add_callback end def size @collection_element.Count end def [](index) return @type.new @collection_element.Item index end def each size.times { |i| yield self[i] } end def add e = @collection_element.CreateNewElement @item_name.to_s added = @type.new e @add_callback.call added unless @add_callback.nil? yield added @collection_element.AddElement e added end def find size.times do |i| instance = self[i] return instance if yield(instance) end nil end def remove(index) @collection_element.DeleteElement index end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inetmgr-0.2.0-mswin32 | lib/inetmgr/iis_object_collection.rb |