Sha256: 3a5334d6fdbbda77d31fcd92508c6dfaea581b04af8121a486c591d6d0945f54
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
class IisObject def initialize element @element = element end def self.prop name, actual_name, setter = Proc.new { |v| v }, reader = Proc.new { |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 def self.collection name, item_name, type define_method(name.to_s) do IisObjectCollection.new @element.Collection, item_name.to_s, type end end 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 def self.child name, element_name, type define_method(name.to_s) do type.new @element.ChildElements.Item(element_name.to_s) end end def element @element end private def method_missing(symbol, *args) name = symbol.to_s if (/=$/.match(name)) @element.Properties.Item(name.sub(/=$/, '')).Value = args[0] else @element.Properties.Item(name).Value end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inetmgr-0.2.0-mswin32 | lib/inetmgr/iis_object.rb |