Module: Jekyll::FlickrHelpers

Extended by:
T::Sig
Defined in:
lib/post_image.rb

Constant Summary collapse

PhotosetId =
T.type_alias { Integer }

Class Method Summary collapse

Class Method Details

.get_first_photoset_id(photoset_id) ⇒ Object



13
14
15
16
17
# File 'lib/post_image.rb', line 13

def self.get_first_photoset_id(photoset_id)
  photoset_id = T.must(photoset_id.first) if photoset_id.is_a?(Array)

  photoset_id
end

.get_photoset_primary_photo(photoset_id) ⇒ Object



20
21
22
23
24
25
# File 'lib/post_image.rb', line 20

def self.get_photoset_primary_photo(photoset_id)
  path = Jekyll.sites.first.data['flickr_photosets'].fetch(photoset_id, {}).fetch('primary_image', nil)
  path.nil? ? nil : "/#{path}"
rescue KeyError
  nil
end