Class: Flickr::AttributeSet
- Inherits:
-
Object
- Object
- Flickr::AttributeSet
- Includes:
- Enumerable
- Defined in:
- lib/flickr/attributes.rb
Overview
Container for the attributes.
Instance Method Summary collapse
- #<<(attribute) ⇒ Object
-
#add_locations(hash) ⇒ Object
Shorthand for adding locations to multiple attributes at once.
- #each(*args, &block) ⇒ Object
-
#find(name = nil) ⇒ Object
Shorthand for finding attributes by name.
-
#initialize(*attributes) ⇒ AttributeSet
constructor
A new instance of AttributeSet.
Constructor Details
#initialize(*attributes) ⇒ AttributeSet
Returns a new instance of AttributeSet.
165 166 167 |
# File 'lib/flickr/attributes.rb', line 165 def initialize(*attributes) @attributes = Array.new(attributes) end |
Instance Method Details
#<<(attribute) ⇒ Object
193 194 195 196 |
# File 'lib/flickr/attributes.rb', line 193 def <<(attribute) @attributes << attribute self end |
#add_locations(hash) ⇒ Object
Shorthand for adding locations to multiple attributes at once.
187 188 189 190 191 |
# File 'lib/flickr/attributes.rb', line 187 def add_locations(hash) hash.each do |attribute_name, locations| find(attribute_name).add_locations(locations) end end |
#each(*args, &block) ⇒ Object
169 170 171 |
# File 'lib/flickr/attributes.rb', line 169 def each(*args, &block) @attributes.each(*args, &block) end |
#find(name = nil) ⇒ Object
Shorthand for finding attributes by name.
176 177 178 179 180 181 182 |
# File 'lib/flickr/attributes.rb', line 176 def find(name = nil) if name super() { |attribute| attribute.name == name } else super() end end |