Class: KeepYourHead::Images

Inherits:
Object
  • Object
show all
Defined in:
lib/Keepyourhead/Images.rb

Class Method Summary collapse

Class Method Details

.fromCacheItem(type, cacheItem) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/Keepyourhead/Images.rb', line 37

def self.fromCacheItem( type, cacheItem)
  if cacheItem then
    if cacheItem.success then
      cacheItem.filenames
    else 
      imageError type
    end
  else
    imageLoading type
  end
end

.fromCompilation(type, compilation) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/Keepyourhead/Images.rb', line 49

def self.fromCompilation( type, compilation)
  if compilation then
    if compilation.success then
      compilation.filenames
    else 
      imageError type
    end
  else
    imageError type
  end
end

.imageError(type) ⇒ Object



30
31
32
# File 'lib/Keepyourhead/Images.rb', line 30

def self.imageError(type)
  [Resources::system("images/error_#{typeToName(type)}.png")]
end

.imageLoading(type) ⇒ Object



33
34
35
# File 'lib/Keepyourhead/Images.rb', line 33

def self.imageLoading(type)
  [Resources::system("images/loading_#{typeToName(type)}.png")]
end

.typeToName(type) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/Keepyourhead/Images.rb', line 21

def self.typeToName(type)
  case type
  when Database::FRONT
    "front"
  when Database::BACK
    "back"
  end
end