Class: Sketchup::AttributeDictionary
- Includes:
- Enumerable
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb
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.
41 42 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 41 def [](key) end |
#[]=(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.
69 70 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 69 def []=(key, value) end |
#count ⇒ Integer
The count method is inherited from the Enumerable mix-in module.
83 84 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 83 def count end |
#delete_key(key) ⇒ Object?
The delete_key method is used to delete an attribute with a given key.
105 106 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 105 def delete_key(key) end |
#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.
139 140 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 139 def each end |
#each_key {|key| ... } ⇒ nil
The #each_key method is used to iterate through all of the attribute keys.
161 162 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 161 def each_key end |
#each_pair {|key, value| ... } ⇒ Object
The #each_pair method is an alias for #each.
190 191 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 190 def each_pair end |
#keys ⇒ Array<String>
The keys method is used to retrieve an array with all of the attribute keys.
210 211 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 210 def keys end |
#length ⇒ Integer
The #length method is used to retrieve the size (number of elements) of an attribute dictionary.
227 228 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 227 def length end |
#name ⇒ String
The name method is used to retrieve the name of an attribute dictionary.
246 247 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 246 def name end |
#size ⇒ Integer
262 263 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 262 def size end |
#values ⇒ Array<Object>
The values method is used to retrieve an array with all of the attribute values.
283 284 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb', line 283 def values end |