From 8b41d15ca790c2786d0e40d59b6f9d1d9a093666 Mon Sep 17 00:00:00 2001 From: Olivier Patry Date: Wed, 15 May 2024 16:38:14 +0200 Subject: [PATCH] Nicer inlined ruby hash --- lib/helpers.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/helpers.rb b/lib/helpers.rb index 2da8b98..a1a71b7 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -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 @@ -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