Method: Inetmgr::IisObject.prop
- Defined in:
- lib/inetmgr/iis_object.rb
.prop(name, actual_name, setter = lambda { |v| v }, reader = lambda { |v| v }) ⇒ Object
Creates a property with the specified name.
Parameters
-
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.
20 21 22 23 24 25 26 27 28 |
# File 'lib/inetmgr/iis_object.rb', line 20 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 |