Parent

IisObjectCollection

Represents a collection of IIS configuration objects.

Public Class Methods

new(element, item_name, type, add_callback = nil) click to toggle source
# File lib/inetmgr/iis_object_collection.rb, line 4
def initialize element, item_name, type, add_callback = nil

        @collection_element = element

        @item_name = item_name

    @type = type

        @add_callback = add_callback

end

Public Instance Methods

[](index) click to toggle source
# File lib/inetmgr/iis_object_collection.rb, line 19
def [](index)

            return @type.new @collection_element.Item index

end
add() click to toggle source
# File lib/inetmgr/iis_object_collection.rb, line 27
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
count() click to toggle source
# File lib/inetmgr/iis_object_collection.rb, line 15
def count

        size

end
each() click to toggle source
# File lib/inetmgr/iis_object_collection.rb, line 23
def each

            size.times { |i| yield self[i] }

end
exists(name) click to toggle source
# File lib/inetmgr/iis_object_collection.rb, line 44
def exists(name)

        !(find {|s| s.name == name}).nil?

end
find() click to toggle source
# File lib/inetmgr/iis_object_collection.rb, line 36
def find 

        size.times do |i|

                instance = self[i]

                return instance if yield(instance)

        end

        nil

end
remove(index) click to toggle source
# File lib/inetmgr/iis_object_collection.rb, line 48
def remove(index)

        @collection_element.DeleteElement index

end
size() click to toggle source
# File lib/inetmgr/iis_object_collection.rb, line 11
def size

        @collection_element.Count

end

[Validate]

Generated with the Darkfish Rdoc Generator 2.