Class: ImagePool

Inherits:
LeafNode
  • Object
show all
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

Instance Method Summary collapse

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

#descriptionObject (readonly)

title -> name



24
25
26
# File 'lib/ralbum/album_tree/image_pool.rb', line 24

def description
  @description
end

#keyObject (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

#md5Object (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



48
49
50
# File 'lib/ralbum/album_tree/image_pool.rb', line 48

def breadcrumbs
  parent.breadcrumbs
end

#default_image_fileObject



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

#relrootObject

paths



40
41
42
# File 'lib/ralbum/album_tree/image_pool.rb', line 40

def relroot
  parent.relroot
end

#relroot_with_prefixObject



44
45
46
# File 'lib/ralbum/album_tree/image_pool.rb', line 44

def relroot_with_prefix
  parent.relroot_with_prefix
end

#thumbObject



70
71
72
# File 'lib/ralbum/album_tree/image_pool.rb', line 70

def thumb
  image("thumb")
end

#to_sObject



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