Class: ImageSite::Index

Inherits:
Model
  • Object
show all
Defined in:
lib/image_site/index.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#number

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#make_subdir, template, #write_html

Constructor Details

#initialize(number, images, options) ⇒ Index

Returns a new instance of Index.



33
34
35
36
# File 'lib/image_site/index.rb', line 33

def initialize(number, images, options)
  super number, options
  @images = images
end

Instance Attribute Details

#imagesObject (readonly)

Returns the value of attribute images.



30
31
32
# File 'lib/image_site/index.rb', line 30

def images
  @images
end

#indexesObject

Returns the value of attribute indexes.



31
32
33
# File 'lib/image_site/index.rb', line 31

def indexes
  @indexes
end

Class Method Details

.write_all(options) ⇒ Object



5
6
7
8
9
10
# File 'lib/image_site/index.rb', line 5

def self.write_all(options)
  images = Image.all options
  indexes = all images, options
  images.each(&:write)
  indexes.each(&:write)
end

Instance Method Details

#relative_htmlObject



43
44
45
# File 'lib/image_site/index.rb', line 43

def relative_html
  "index#{if @number > 1 then @number end}.html"
end

#writeObject



38
39
40
41
# File 'lib/image_site/index.rb', line 38

def write
  images.each(&:write_thumbnail)
  write_html index: self
end