An OptionsProvider class provides various kinds of options on a Model. You get an OptionsProvider from the OptionsManager. The options are given as name/value pairs.
The [] method is used to get a value by name or index of the key.
Arguments:
Returns:
model = Sketchup.active_model manager = model.options provider = manager[0] # Retrieves the provider at index 1 option = provider[1]
The []= method is used to set the value of a specific key.
Creates a new attribute for the given key if needed.
Arguments:
Returns:
option = provider[1]=10
The add_observer method is used to add an observer to the current object.
Arguments:
Returns:
status = object.add_observer observer
The count method is used to retrieve the size (number of elements) of an options provider.
Returns:
count = optionsprovider.count
The each method is used to iterate through all of the attributes.
Throws an exception if there are no keys.
Arguments:
Returns:
# Retrieves each key
provider.each { |key, value| UI.messagebox key }
# Retrieves each corresponding value
provider.each { |key, value| UI.messagebox value }
The each_key method is used to iterate through all of the attribute keys.
Throws an exception if there are no keys.
Arguments:
Returns:
provider.each_key { |key| UI.messagebox key }
An alias for each. See OptionsProvider.each
Throws an exception if there are no keys.
Arguments:
Returns:
# Retrieves each key
provider.each_pair { |key, value| UI.messagebox key }
The each_value method is used to iterate through all of the attribute
values.
Throws an exception if there are no keys.
Arguments:
Returns:
provider.each_value { |value| UI.messagebox value }The has_key? method is used to determine if the options provider has a specific key.
Arguments:
Returns:
status = provider.has_key? "PageOptions" if (status) UI.messagebox status else UI.messagebox "Failure" end
The key? method is used to determine if the options provider has a specific key. This method is the same as has_key? See also OptionsManager.has_key
Arguments:
Returns:
status = provider.key? "name"
The keys method is used to retrieve an array with all of the attribute keys.
Returns:
keys = provider.keys key = keys[0] if (key) UI.messagebox key else UI.messagebox "Failure" end
The name method is used to retrieve the name of an options provider.
Returns:
name = provider.name
The remove_observer method is used to remove an observer from the current object.
Arguments:
Returns:
status = object.remove_observer observer
The size method is used to retrieve the size (number of elements) of an options provider.
Returns:
size = optionsprovider.size