Class: Sketchup::AttributeDictionary
Relationships | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Entity
|
|
Instance Chain:
self,
Enumerable,
Entity
|
|
Inherits: |
Sketchup::Entity
|
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 Attribute Summary
Entity
- Inherited
Instance Method Summary
-
#[](key) ⇒ Object?
The [] method is used to retrieve the attribute with a given key.
-
#[]=(key, value)
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| ... }
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| ... }
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.
Entity
- Inherited
#add_observer | The add_observer method is used to add an observer to the current object. |
#attribute_dictionaries | The attribute_dictionaries method is used to retrieve the |
#attribute_dictionary | The attribute_dictionary method is used to retrieve an attribute dictionary with a given name that is attached to an |
#delete_attribute | The |
#entityID | The entityID method is used to retrieve a unique ID assigned to an entity. |
#get_attribute | The |
#inspect | The |
#model | The model method is used to retrieve the model for the entity. |
#parent | The parent method is used to retrieve the parent of the entity. |
#persistent_id | The |
#remove_observer | The remove_observer method is used to remove an observer from the current object. |
#set_attribute | The set attribute is used to set the value of an attribute in an attribute dictionary with the given name. |
#to_s | The |
#typename | The typename method retrieves the type of the entity, which will be a string such as “Face”, “Edge”, or “Group”. |
Instance Method Details
#[](key) ⇒ Object
?
The [] method is used to retrieve the attribute with a given key.
#[]=(key, value)
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| ... }
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| ... }
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
The #size
method is an alias of #length.
#values ⇒ Array<Object
>
The values method is used to retrieve an array with all of the attribute values.