From 2ee45e8cac909991ddf782a8d2947ae99473404a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 14 Nov 2010 16:24:21 +0000 Subject: Use Object#tap instead of #returning (#6887). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4406 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/hook.rb | 2 +- lib/redmine/menu_manager.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/redmine/hook.rb b/lib/redmine/hook.rb index 7f4b6e07e..84c33e326 100644 --- a/lib/redmine/hook.rb +++ b/lib/redmine/hook.rb @@ -57,7 +57,7 @@ module Redmine # Calls a hook. # Returns the listeners response. def call_hook(hook, context={}) - returning [] do |response| + [].tap do |response| hls = hook_listeners(hook) if hls.any? hls.each {|listener| response << listener.send(hook, context)} diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index 4094a9c14..996b1c5b4 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -192,13 +192,13 @@ module Redmine def render_menu_node_with_children(node, project=nil) caption, url, selected = extract_node_details(node, project) - html = returning [] do |html| + html = [].tap do |html| html << '
  • ' # Parent html << render_single_menu_node(node, caption, url, selected) # Standard children - standard_children_list = returning "" do |child_html| + standard_children_list = "".tap do |child_html| node.children.each do |child| child_html << render_menu_node(child, project) end @@ -219,7 +219,7 @@ module Redmine def render_unattached_children_menu(node, project) return nil unless node.child_menus - returning "" do |child_html| + "".tap do |child_html| unattached_children = node.child_menus.call(project) # Tree nodes support #each so we need to do object detection if unattached_children.is_a? Array -- cgit v1.2.3