Sha256: 1d9ed6521303a1c0a846f2629f66c22e365bec746c196d9b33a8d9df305041f0
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
# ralbum require 'treevisitor/leaf_node' # # ImagePool e' creata da una PhotoItem identificata da un md5 # ImagePool ha una 'key' con cui viene identificata nel catalog # ha un 'title' che e' anche il 'name' del LeafNode # ha una 'description' della photo che rappresenta # class ImagePool < LeafNode # include ObjectWithProperties # # md5 of original photo # attr_reader :md5 # # key (number) assigned by catalog for the original photo # attr_reader :key # title -> name attr_reader :description def initialize( album, md5, key, title, description ) super( title, album ) @md5 = md5 @key = key @album = album @description = description @images = {} end ############################################################################ # paths def relroot parent.relroot end def relroot_with_prefix parent.relroot_with_prefix end def breadcrumbs parent.breadcrumbs end ############################################################################ # images management def image( type, image_file = nil) if image_file @images[ type ] = image_file end res = @images[ type ] if res.nil? raise "image type '#{type}' of photo '#{name}' not found" end res end def default_image_file image("default") end def thumb image("thumb") end ############################################################################ def to_s str = "ip: #{name.to_s} -#{@images.length}-" @images.each_key { |key| str += key.to_s } str end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gf-ralbum-0.0.5 | lib/ralbum/album_tree/image_pool.rb |