Skip to content

Commit

Permalink
Nicer inlined ruby hash
Browse files Browse the repository at this point in the history
  • Loading branch information
opatry committed May 15, 2024
1 parent 6004793 commit 8b41d15
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ def to_json(book, url: :relative)
cover_path = cover.path(rep: :mini) unless cover.nil?
url_prefix = url == :absolute ? @config[:site][:url] : ''
{
'isbn' => book[:isbn],
'uuid' => book[:uuid],
'title' => book[:title],
'author' => book[:author],
'link' => "#{url_prefix}#{book.path}",
'rating' => book[:rating] || 0,
'favorite' => book[:favorite] || false,
'cover' => "#{url_prefix}#{cover_path}" || ''
'isbn': book[:isbn],
'uuid': book[:uuid],
'title': book[:title],
'author': book[:author],
'link': "#{url_prefix}#{book.path}",
'rating': book[:rating] || 0,
'favorite': book[:favorite] || false,
'cover': "#{url_prefix}#{cover_path}" || ''
}
end

Expand Down Expand Up @@ -88,10 +88,10 @@ def natural_sort(books)

def pwa_screenshot_to_json(item)
{
'src' => item.path,
'sizes' => "#{item[:width]}x#{item[:height]}",
'type'=> item[:mime_type],
'platform' => item[:pwa_platform],
'form_factor' => item[:pwa_form_factor]
'src': item.path,
'sizes': "#{item[:width]}x#{item[:height]}",
'type': item[:mime_type],
'platform': item[:pwa_platform],
'form_factor': item[:pwa_form_factor]
}
end

0 comments on commit 8b41d15

Please sign in to comment.