Module: FlickrawObjects::Attributes

Included in:
Person, Photo, Photoset
Defined in:
lib/flickraw_objects/attributes.rb

Defined Under Namespace

Modules: Boolean, ClassMethods

Constant Summary collapse

COERCIONS =
{
  String  => lambda { |value| String(value) },
  Boolean => lambda { |value| Integer(value) == 1 },
  Integer => lambda { |value| Integer(value) },
  Float => lambda { |value| Float(value) },
  Time => lambda { |value|
    begin
      Time.at(Integer(value))
    rescue
      DateTime.parse(value).to_time 
    end
  }
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#initObject (readonly)

Returns the value of attribute init.



61
62
63
# File 'lib/flickraw_objects/attributes.rb', line 61

def init
  @init
end

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/flickraw_objects/attributes.rb', line 4

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#initialize(response) ⇒ Object



63
64
65
# File 'lib/flickraw_objects/attributes.rb', line 63

def initialize(response) 
    @init = response 
end