Class: ImageGallery::GalleryGenerator::GalleryModel

Inherits:
Struct
  • Object
show all
Defined in:
lib/gallery/gallery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#datetimeObject

Returns the value of attribute datetime

Returns:

  • (Object)

    the current value of datetime



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

def datetime
  @datetime
end

#highlight_imageObject

Returns the value of attribute highlight_image

Returns:

  • (Object)

    the current value of highlight_image



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

def highlight_image
  @highlight_image
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



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

def id
  @id
end

#imagesObject

Returns the value of attribute images

Returns:

  • (Object)

    the current value of images



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

def images
  @images
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



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

def name
  @name
end

Instance Method Details

#to_liquidObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gallery/gallery.rb', line 21

def to_liquid
  to_h.map do |k, v|
    if k == :datetime
      [k.to_s, { 'year' => v.year, 'month' => v.month, 'day' => v.day }]
    elsif v.class.method_defined?(:to_liquid)
      [k.to_s, v.to_liquid]
    else
      [k.to_s, v]
    end
  end.to_h
end