From b0c2c1a1afdec6b99c5ae7029a9a314319b979e8 Mon Sep 17 00:00:00 2001 From: Gregor Schmidt Date: Thu, 23 Dec 2010 10:36:26 +0100 Subject: [PATCH] Replacing Kernel#returning with Object#tap to avoid deprec warnings --- app/models/report/chainable.rb | 4 ++-- app/models/report/sql_statement.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/report/chainable.rb b/app/models/report/chainable.rb index 3b0f469779..2c266e64a6 100644 --- a/app/models/report/chainable.rb +++ b/app/models/report/chainable.rb @@ -101,7 +101,7 @@ class Report < ActiveRecord::Base end def to_a - returning([to_hash]) { |a| a.unshift(*child.to_a) unless bottom? } + [to_hash].tap { |a| a.unshift(*child.to_a) unless bottom? } end def top @@ -293,4 +293,4 @@ class Report < ActiveRecord::Base end end -end \ No newline at end of file +end diff --git a/app/models/report/sql_statement.rb b/app/models/report/sql_statement.rb index 3aded2e7ef..c2f415b64a 100644 --- a/app/models/report/sql_statement.rb +++ b/app/models/report/sql_statement.rb @@ -171,7 +171,7 @@ class Report::SqlStatement # @return [Array] All fields/statements for select part def select(*fields) return(@select || default_select) if fields.empty? - returning(@select ||= []) do + (@select ||= []).tap do @sql = nil fields.each do |f| case f @@ -200,7 +200,7 @@ class Report::SqlStatement # @param [Array, String, Symbol] fields Fields to add def group_by(*fields) @sql = nil unless fields.empty? - returning(@group_by ||= []) do + (@group_by ||= []).tap do fields.each do |e| if e.is_a? Array and (e.size != 2 or !e.first.respond_to? :table_name) group_by(*e)