From f48e41728a66d1031221a5fb9cb7c96500ba31b7 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Fri, 22 Mar 2024 08:48:47 +1100 Subject: [PATCH] StandardRb --- app/action.rb | 2 +- config/providers/clients.rb | 2 +- lib/adamantium/jobs/save_email_reply.rb | 2 +- lib/adamantium/view_cache/redis_cache_store.rb | 1 - slices/main/actions/posts/index.rb | 6 +++--- slices/main/decorators/posts/decorator.rb | 6 +++--- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/action.rb b/app/action.rb index 35c2e59..e45e46a 100644 --- a/app/action.rb +++ b/app/action.rb @@ -22,7 +22,7 @@ module Adamantium handle_exception ROM::TupleCountMismatchError => :not_found handle_exception StandardError => :handle_error - def cache(key:, params: [], content_proc:, expiry: TimeMath.min.advance(Time.now, +10)) + def cache(key:, content_proc:, params: [], expiry: TimeMath.min.advance(Time.now, +10)) cacher.call(key: key, params: params, content_proc: content_proc, expiry: expiry) end diff --git a/config/providers/clients.rb b/config/providers/clients.rb index 434c5b2..64761fb 100644 --- a/config/providers/clients.rb +++ b/config/providers/clients.rb @@ -4,7 +4,7 @@ Hanami.app.register_provider :clients, namespace: true do register "blue_sky", Adamantium::Client::BlueSky.new register "omdb", Adamantium::Client::Omdb.new(api_key: target["settings"].omdb_api_key) register "gist", Adamantium::Client::Gist.new(token: target["settings"].gist_client_token) - + require "redis" register "redis", Redis.new end diff --git a/lib/adamantium/jobs/save_email_reply.rb b/lib/adamantium/jobs/save_email_reply.rb index b3e741e..4b650ee 100644 --- a/lib/adamantium/jobs/save_email_reply.rb +++ b/lib/adamantium/jobs/save_email_reply.rb @@ -14,7 +14,7 @@ module Adamantium return unless mail.subject == "About that post of yours" reply_content, in_reply_to = mail.body.decoded.split("---") - post_url = URI.join(settings.micropub_site_url, in_reply_to.match(URI::DEFAULT_PARSER.make_regexp)[7]&.gsub(")", "")).to_s + post_url = URI.join(settings.micropub_site_url, in_reply_to.match(URI::DEFAULT_PARSER.make_regexp)[7]&.delete(")")).to_s slug = post_url.split("/").last post = post_repo.fetch!(slug) diff --git a/lib/adamantium/view_cache/redis_cache_store.rb b/lib/adamantium/view_cache/redis_cache_store.rb index e6308ed..629e86a 100644 --- a/lib/adamantium/view_cache/redis_cache_store.rb +++ b/lib/adamantium/view_cache/redis_cache_store.rb @@ -15,4 +15,3 @@ module Adamantium end end end - diff --git a/slices/main/actions/posts/index.rb b/slices/main/actions/posts/index.rb index ee73ef6..fff6f07 100644 --- a/slices/main/actions/posts/index.rb +++ b/slices/main/actions/posts/index.rb @@ -4,9 +4,9 @@ module Main class Index < Action include Deps["views.posts.index"] def handle(req, res) - res.body = cache(key: "posts_index", - params: [req.params[:q]], - content_proc: ->(q) { index.call(context: Main::Views::Context.new(request: req), query: q) }) + res.body = cache(key: "posts_index", + params: [req.params[:q]], + content_proc: ->(q) { index.call(context: Main::Views::Context.new(request: req), query: q) }) end end end diff --git a/slices/main/decorators/posts/decorator.rb b/slices/main/decorators/posts/decorator.rb index 3492e1c..4d8f3bd 100644 --- a/slices/main/decorators/posts/decorator.rb +++ b/slices/main/decorators/posts/decorator.rb @@ -60,9 +60,9 @@ module Main "📷" else @prefix_emoji ||= if (match = content.match(Unicode::Emoji::REGEX)) - match - else - "💬" + match + else + "💬" end end end