Class: ImagePool
- Inherits:
-
LeafNode
- Object
- LeafNode
- ImagePool
- Defined in:
- lib/ralbum/album_tree/image_pool.rb
Overview
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
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
title -> name.
-
#key ⇒ Object
readonly
key (number) assigned by catalog for the original photo.
-
#md5 ⇒ Object
readonly
md5 of original photo.
Instance Method Summary collapse
- #breadcrumbs ⇒ Object
- #default_image_file ⇒ Object
-
#image(type, image_file = nil) ⇒ Object
images management.
-
#initialize(album, md5, key, title, description) ⇒ ImagePool
constructor
A new instance of ImagePool.
-
#relroot ⇒ Object
paths.
- #relroot_with_prefix ⇒ Object
- #thumb ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(album, md5, key, title, description) ⇒ ImagePool
Returns a new instance of ImagePool.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 26 def initialize( album, md5, key, title, description ) super( title, album ) @md5 = md5 @key = key @album = album @description = description @images = {} end |
Instance Attribute Details
#description ⇒ Object (readonly)
title -> name
24 25 26 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 24 def description @description end |
#key ⇒ Object (readonly)
key (number) assigned by catalog for the original photo
21 22 23 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 21 def key @key end |
#md5 ⇒ Object (readonly)
md5 of original photo
16 17 18 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 16 def md5 @md5 end |
Instance Method Details
#breadcrumbs ⇒ Object
48 49 50 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 48 def parent. end |
#default_image_file ⇒ Object
66 67 68 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 66 def default_image_file image("default") end |
#image(type, image_file = nil) ⇒ Object
images management
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 55 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 |
#relroot ⇒ Object
paths
40 41 42 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 40 def relroot parent.relroot end |
#relroot_with_prefix ⇒ Object
44 45 46 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 44 def relroot_with_prefix parent.relroot_with_prefix end |
#thumb ⇒ Object
70 71 72 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 70 def thumb image("thumb") end |
#to_s ⇒ Object
76 77 78 79 80 |
# File 'lib/ralbum/album_tree/image_pool.rb', line 76 def to_s str = "ip: #{name.to_s} -#{@images.length}-" @images.each_key { |key| str += key.to_s } str end |