From 2995e3f3b1fb8292342acbbec59b6039e7c791dd Mon Sep 17 00:00:00 2001 From: Gabriel Malaquias <5194287+GabrielMalakias@users.noreply.github.com> Date: Fri, 15 Oct 2021 13:46:56 +0200 Subject: [PATCH 1/2] Use SingleForwardable to avoid method boilerplate --- lib/shoryuken/message.rb | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/lib/shoryuken/message.rb b/lib/shoryuken/message.rb index e9e84019..2732f713 100644 --- a/lib/shoryuken/message.rb +++ b/lib/shoryuken/message.rb @@ -1,5 +1,16 @@ module Shoryuken class Message + extend SingleForwardable + + def_delegators(:data, + :message_id, + :receipt_handle, + :md5_of_body, + :body, + :attributes, + :md5_of_message_attributes, + :message_attributes) + attr_accessor :client, :queue_url, :queue_name, :data def initialize(client, queue, data) @@ -29,33 +40,5 @@ def visibility_timeout=(timeout) visibility_timeout: timeout ) end - - def message_id - data.message_id - end - - def receipt_handle - data.receipt_handle - end - - def md5_of_body - data.md5_of_body - end - - def body - data.body - end - - def attributes - data.attributes - end - - def md5_of_message_attributes - data.md5_of_message_attributes - end - - def message_attributes - data.message_attributes - end end end From 284691f4cc27822be275468fcfd5c23c4897f133 Mon Sep 17 00:00:00 2001 From: Gabriel Malaquias <5194287+GabrielMalakias@users.noreply.github.com> Date: Tue, 19 Oct 2021 15:40:40 +0200 Subject: [PATCH 2/2] change to Forwardable --- lib/shoryuken/message.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/shoryuken/message.rb b/lib/shoryuken/message.rb index 2732f713..182f22b7 100644 --- a/lib/shoryuken/message.rb +++ b/lib/shoryuken/message.rb @@ -1,6 +1,6 @@ module Shoryuken class Message - extend SingleForwardable + extend Forwardable def_delegators(:data, :message_id,