From e956460d18da996b93efeedf326d582fc3ebc3a4 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 5 May 2021 09:25:22 -0500 Subject: [PATCH] Use Forwardable for simple delegations --- lib/customer.rb | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/customer.rb b/lib/customer.rb index 90eed16..ddac1e9 100644 --- a/lib/customer.rb +++ b/lib/customer.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "forwardable" + require_relative "./ibr" require_relative "./payment_methods" require_relative "./plan" @@ -23,7 +25,11 @@ class Customer end end + extend Forwardable + attr_reader :customer_id, :balance + def_delegator :@plan, :name, :plan_name + def_delegators :@plan, :currency, :merchant_account def initialize( customer_id, @@ -46,17 +52,6 @@ class Customer ) end - def plan_name - @plan.name - end - - def currency - @plan.currency - end - - def merchant_account - @plan.merchant_account - end def payment_methods @payment_methods ||= -- 2.34.7