Class: GalleryGenerator::ViewableGallery

Inherits:
Object
  • Object
show all
Defined in:
lib/m1key_gallery_generator/viewable_gallery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, description, slug, sources, upload_date, map_url, map_title, year, viewable_photos, small_print, blurb) ⇒ ViewableGallery

Returns a new instance of ViewableGallery.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 6

def initialize(title, description, slug, sources, upload_date, map_url, map_title, year, viewable_photos, small_print, blurb)
  @title = String.new(title)
  @description = description
  @slug = slug
  @sources = sources
  @upload_date = upload_date
  @map_url = map_url
  @map_title = map_title
  @year = year
  @photos = viewable_photos
  @small_print = small_print
  @blurb = blurb
end

Instance Attribute Details

#blurbObject (readonly)

Returns the value of attribute blurb.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def blurb
  @blurb
end

#descriptionObject (readonly)

Returns the value of attribute description.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def description
  @description
end

#map_titleObject (readonly)

Returns the value of attribute map_title.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def map_title
  @map_title
end

#map_urlObject (readonly)

Returns the value of attribute map_url.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def map_url
  @map_url
end

#photosObject (readonly)

Returns the value of attribute photos.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def photos
  @photos
end

#slugObject (readonly)

Returns the value of attribute slug.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def slug
  @slug
end

#small_printObject (readonly)

Returns the value of attribute small_print.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def small_print
  @small_print
end

#sourcesObject (readonly)

Returns the value of attribute sources.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def sources
  @sources
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def title
  @title
end

#upload_dateObject (readonly)

Returns the value of attribute upload_date.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def upload_date
  @upload_date
end

#yearObject (readonly)

Returns the value of attribute year.



5
6
7
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 5

def year
  @year
end

Instance Method Details

#get_bindingObject



20
21
22
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 20

def get_binding
  binding
end

#to_viewable_photos(mutable_viewable_photos) ⇒ Object



36
37
38
39
40
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 36

def to_viewable_photos(mutable_viewable_photos)
  mutable_viewable_photos.map do |mutable_viewable_photo|
    ViewablePhoto.new(mutable_viewable_photo.id, mutable_viewable_photo.title, mutable_viewable_photo.description, mutable_viewable_photo., mutable_viewable_photo.technical_info)
  end
end

#update_using(*update_functions) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/m1key_gallery_generator/viewable_gallery.rb', line 24

def update_using(*update_functions)
  updated_gallery = MutableViewableGallery.new(self)

  update_functions.each do |update_function|
    updated_gallery = update_function.call(updated_gallery)
  end

  ViewableGallery.new(updated_gallery.title, updated_gallery.description, updated_gallery.slug,
      updated_gallery.sources, updated_gallery.upload_date, updated_gallery.map_url,
      updated_gallery.map_title, updated_gallery.year, to_viewable_photos(updated_gallery.photos), updated_gallery.small_print, updated_gallery.blurb)
end