Class: Layout::Dictionary
| Relationships | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
self,
Enumerable
|
|
| Inherits: | Object |
Overview
This is the interface to a LayOut dictionary. A Dictionary wraps key/value pairs.
Class Method Summary
-
.new ⇒ Layout::Dictionary
constructor
The
#initializemethod creates a newDictionary.
Instance Attribute Summary
-
#empty? ⇒ Boolean
readonly
The #empty? method checks if the dictionary is empty.
Instance Method Summary
-
#[](key) ⇒ String, ...
The #[] method retrieves the value for a given key.
-
#[]=(key, value)
The #[]= method sets a value for a given key.
-
#delete_key(key) ⇒ String, ...
The #delete_key method deletes a key/value pair from the dictionary.
-
#each {|key, value| ... }
The #each_pair method is an alias for #each.
-
#each_key {|key| ... }
The #each_key method iterates through all of the dictionary keys.
-
#each_pair {|key, value| ... }
The #each_pair method is an alias for #each.
-
#keys ⇒ Array<String>
The #keys method retrieves an array with all of the dictionary keys.
-
#length ⇒ Integer
The #length method retrieves the size (number of elements) of a dictionary.
-
#size ⇒ Integer
The #length method retrieves the size (number of elements) of a dictionary.
-
#values ⇒ Array<Object>
The #values method retrieves an array with all of the dictionary values.
Constructor Details
.new ⇒ Dictionary
.new(dict) ⇒ Dictionary
Dictionary
.new(dict) ⇒ Dictionary
The #initialize method creates a new Dictionary.
Instance Attribute Details
#empty? ⇒ Boolean (readonly)
The #empty? method checks if the dictionary is empty.
Instance Method Details
#[](key) ⇒ String, ...
The #[] method retrieves the value for a given key.
#[]=(key, value)
The #[]= method sets a value for a given key.
Creates a new dictionary entry for the given key if needed.
#delete_key(key) ⇒ String, ...
The #delete_key method deletes a key/value pair from the dictionary.
#each {|key, value| ... }
The #each_pair method is an alias for #each.
#each_key {|key| ... }
The #each_key method iterates through all of the dictionary keys.
#each_pair {|key, value| ... }
The #each_pair method is an alias for #each.
#keys ⇒ Array<String>
The #keys method retrieves an array with all of the dictionary keys.
#length ⇒ Integer
The #length method retrieves the size (number of elements) of a dictionary.
#size ⇒ Integer
The #length method retrieves the size (number of elements) of a dictionary.
#values ⇒ Array<Object>
The #values method retrieves an array with all of the dictionary values.