Represents an IIS configuration element. Serves as the base class for all IIS artifacts like Site, Application and VirtualDirectory.
# File lib/inetmgr/iis_object.rb, line 52 def self.child name, element_name, type define_method(name.to_s) do type.new @element.ChildElements.Item(element_name.to_s) end end
Creates a collection property with the specified name.
name - The name of the property to create
item_name - The name of the element in the configuration schema.
type - The collection's item type.
# File lib/inetmgr/iis_object.rb, line 46 def self.children name, item_name, type define_method(name.to_s) do IisObjectCollection.new @element.ChildElements.Item(name.to_s).Collection, item_name.to_s, type end end
Creates a collection property with the specified name.
name - The name of the property to create
type - The collection's item type.
# File lib/inetmgr/iis_object.rb, line 34 def self.collection name, item_name, type define_method(name.to_s) do IisObjectCollection.new @element.Collection, item_name.to_s, type end end
# File lib/inetmgr/iis_object.rb, line 5 def initialize element @element = element end
Creates a property with the specified name.
name - The name of the property to create
actual_name - Optional, The actual name of the attribute or
element in the IIS configuration schema.
setter - Optional, a lambda or proc to convert the property
value to a value in the IIS configuration schema.
reader - Optional, a lambda or proc to convert the IIS
configuration value to the desired property value.
# File lib/inetmgr/iis_object.rb, line 19 def self.prop name, actual_name, setter = lambda { |v| v }, reader = lambda { |v| v } define_method(name.to_s) do reader.call(@element.Properties.Item(actual_name.to_s).Value) end define_method("#{name.to_s}=") do |val| @element.Properties.Item(actual_name.to_s).Value = setter.call(val) end end
# File lib/inetmgr/iis_object.rb, line 58 def invoke_method name method = @element.Methods.Item(name.to_s).CreateInstance() # TODO: if block_given? change method_missing to change this: # method.Input.Properties.Item("key").Value = value # in to this: # method.key = value yield method if block_given? method.Execute() end
Generated with the Darkfish Rdoc Generator 2.