Class: Sketchup::AttributeDictionary
Overview
The AttributeDictionary class allows you to attach arbitrary collections of attributes to a SketchUp entity. The attributes are defined by key/value pairs where the keys are strings. An Entity or Model object can have any number of AttributeDictionary objects (see the AttributeDictionaries class).
The Entity class is a popular parent class in SketchUp, meaning you can attach attribute dictionaries to almost anything, from geometric items like edges and faces and components to more conceptual things like pages or materials.
Instance Method Summary # collapse
-
#[](key) ⇒ Object?
The [] method is used to retrieve the attribute with a given key.
-
#[]=(key, value) ⇒ Object
The set value ([]=) method is used to set the value of an attribute with a given key.
-
#count ⇒ Integer
The count method is inherited from the Enumerable mix-in module.
-
#delete_key(key) ⇒ Object?
The delete_key method is used to delete an attribute with a given key.
-
#each {|key, value| ... } ⇒ Object
The #each method iterate through all of the attributes.
-
#each_key {|key| ... } ⇒ nil
The #each_key method is used to iterate through all of the attribute keys.
-
#each_pair {|key, value| ... } ⇒ Object
The #each_pair method is an alias for #each.
-
#keys ⇒ Array<String>
The keys method is used to retrieve an array with all of the attribute keys.
-
#length ⇒ Integer
The #length method is used to retrieve the size (number of elements) of an attribute dictionary.
-
#name ⇒ String
The name method is used to retrieve the name of an attribute dictionary.
- #size ⇒ Integer
-
#values ⇒ Array<Object>
The values method is used to retrieve an array with all of the attribute values.
Methods inherited from Entity
#add_observer, #attribute_dictionaries, #attribute_dictionary, #delete_attribute, #deleted?, #entityID, #get_attribute, #inspect, #model, #parent, #persistent_id, #remove_observer, #set_attribute, #to_s, #typename, #valid?
Instance Method Details
↑ #[](key) ⇒ Object?
The [] method is used to retrieve the attribute with a given key.
↑ #[]=(key, value) ⇒ Object
The set value ([]=) method is used to set the value of an attribute with a given key.
Creates a new attribute for the given key if needed.
↑ #count ⇒ Integer
The count method is inherited from the Enumerable mix-in module.
↑ #delete_key(key) ⇒ Object?
The delete_key method is used to delete an attribute with a given key.
↑ #each {|key, value| ... } ⇒ Object
Don't remove content from this collection while iterating over it with #each. This would change the size of the collection and cause elements to be skipped as the indices change. Instead copy the current collection to an array using to_a
and then use each
on the array, when removing content.
The #each method iterate through all of the attributes.
↑ #each_key {|key| ... } ⇒ nil
The #each_key method is used to iterate through all of the attribute keys.
↑ #each_pair {|key, value| ... } ⇒ Object
The #each_pair method is an alias for #each.
↑ #keys ⇒ Array<String>
The keys method is used to retrieve an array with all of the attribute keys.