Module: Flickr::Attributes

Included in:
Object, Object::List
Defined in:
lib/flickr/attributes.rb

Overview

A module that provides functionality of defining attributes of which locations can be found in the JSON response from Flickr.

Instance Method Summary collapse

Instance Method Details

#attribute(name, type) ⇒ Object

Registers an attribute (name + type), defining the getter method (and in the boolean case an additional predicated alias).



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/flickr/attributes.rb', line 25

def attribute(name, type)
  new_attribute = Attribute.new(name, type)

  attributes << new_attribute

  define_method(name) do
    self.class.attributes.find(name).value(self)
  end
  alias_method "#{name}?", name if type == Boolean

  new_attribute
end

#attributesObject

List of all registered attributes.



41
42
43
# File 'lib/flickr/attributes.rb', line 41

def attributes
  @attributes ||= AttributeSet.new
end