class Plugin::Photo::Photo

Public Class Methods

[](uri) click to toggle source
# File core/plugin/photo/model/photo.rb, line 13
def self.[](uri)
  case uri
  when self
    uri
  when URI, Addressable::URI, Diva::URI
    photos[uri.to_s.hash] ||= new(perma_link: uri)
  when String
    if uri.start_with?('http')
      photos[uri.hash] ||= new(perma_link: uri)
    elsif uri.start_with?('/')
      uri = Diva::URI.new(scheme: 'file', path: uri)
      photos[uri.hash] ||= new(perma_link: uri)
    end
  end
end
new(*params) click to toggle source
Calls superclass method Diva::Model::PhotoMixin.new
# File core/plugin/photo/model/photo.rb, line 29
def initialize(*params)
  super
  self.class.photos[uri.to_s.hash] = self
end
photos() click to toggle source
# File core/plugin/photo/model/photo.rb, line 9
def self.photos
  @photos ||= TimeLimitedStorage.new(Integer, self)
end