diff --git a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb index e282825ba6..e6fbcb18cf 100644 --- a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb +++ b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb @@ -237,7 +237,7 @@ def thumbnail_class # Copies the given file path to a new tempfile, returning the closed tempfile. def copy_to_temp_file(file, temp_base_name) - returning Tempfile.new(temp_base_name, Technoweenie::AttachmentFu.tempfile_path) do |tmp| + Tempfile.new(temp_base_name, Technoweenie::AttachmentFu.tempfile_path).tap do |tmp| tmp.close FileUtils.cp file, tmp.path end @@ -245,7 +245,7 @@ def copy_to_temp_file(file, temp_base_name) # Writes the given data to a new tempfile, returning the closed tempfile. def write_to_temp_file(data, temp_base_name) - returning Tempfile.new(temp_base_name, Technoweenie::AttachmentFu.tempfile_path) do |tmp| + Tempfile.new(temp_base_name, Technoweenie::AttachmentFu.tempfile_path).tap do |tmp| tmp.binmode tmp.write data tmp.close @@ -288,7 +288,7 @@ def thumbnail_name_for(thumbnail = nil) # Creates or updates the thumbnail for the current attachment. def create_or_update_thumbnail(temp_file, file_name_suffix, *size) thumbnailable? || raise(ThumbnailError.new("Can't create a thumbnail if the content type is not an image or there is no parent_id column")) - returning find_or_initialize_thumbnail(file_name_suffix) do |thumb| + find_or_initialize_thumbnail(file_name_suffix).tap do |thumb| thumb.temp_paths.unshift temp_file thumb.send(:'attributes=', { :content_type => content_type, @@ -409,7 +409,7 @@ def random_tempfile_filename def sanitize_filename(filename) return unless filename - returning filename.strip do |name| + filename.strip.tap do |name| # NOTE: File.basename doesn't work right with Windows paths on Unix # get only the filename, not the whole path name.gsub! /^.*(\\|\/)/, '' diff --git a/vendor/plugins/i18n-js/lib/i18n-js.rb b/vendor/plugins/i18n-js/lib/i18n-js.rb index 0bc29c4d41..27d08a0499 100644 --- a/vendor/plugins/i18n-js/lib/i18n-js.rb +++ b/vendor/plugins/i18n-js/lib/i18n-js.rb @@ -116,7 +116,7 @@ def deep_merge!(target, hash) # :nodoc: # Taken from http://seb.box.re/2010/1/15/deep-hash-ordering-with-ruby-1-8/ def sorted_hash(object, deep = false) # :nodoc: if object.is_a?(Hash) - res = returning(ActiveSupport::OrderedHash.new) do |map| + res = ActiveSupport::OrderedHash.new.tap do |map| object.each {|k, v| map[k] = deep ? sorted_hash(v, deep) : v } end return res.class[res.sort {|a, b| a[0].to_s <=> b[0].to_s } ] diff --git a/vendor/plugins/i18n/lib/i18n_filter.rb b/vendor/plugins/i18n/lib/i18n_filter.rb index 73949fd6aa..73c64e0ef2 100644 --- a/vendor/plugins/i18n/lib/i18n_filter.rb +++ b/vendor/plugins/i18n/lib/i18n_filter.rb @@ -16,13 +16,13 @@ def around_recognize(path, env, &block) ::I18n.locale = ::Refinery::I18n.default_frontend_locale end - returning yield do |params| + yield.tap do |params| unless path =~ %r{^/(admin|refinery|wymiframe)} or ::I18n.locale == ::Refinery::I18n.default_frontend_locale params[:locale] = (locale.presence || ::Refinery::I18n.current_frontend_locale) end end else - returning yield do |result| + yield.tap do |result| result end end @@ -31,14 +31,14 @@ def around_recognize(path, env, &block) def around_generate(*args, &block) if ::Refinery::I18n.enabled? locale = args.extract_options!.delete(:locale) || ::I18n.locale - returning yield do |result| + yield.tap do |result| if (locale != ::Refinery::I18n.default_frontend_locale and result !~ %r{^/(refinery|wymiframe)}) result.sub!(%r(^(http.?://[^/]*)?(.*))){ "#{$1}/#{locale}#{$2}" } end result end else - returning yield do |result| + yield.tap do |result| result end end diff --git a/vendor/plugins/i18n/lib/routing_filter/README.markdown b/vendor/plugins/i18n/lib/routing_filter/README.markdown index 77ee55d5aa..3d8d43d2cf 100644 --- a/vendor/plugins/i18n/lib/routing_filter/README.markdown +++ b/vendor/plugins/i18n/lib/routing_filter/README.markdown @@ -22,7 +22,7 @@ The following would be a sceleton of an empty filter: # Alter the path here before it gets recognized. # Make sure to yield (calls the next around filter if present and # eventually `recognize_path` on the routeset): - returning yield do |params| + yield.tap do |params| # You can additionally modify the params here before they get passed # to the controller. end @@ -32,7 +32,7 @@ The following would be a sceleton of an empty filter: # Alter arguments here before they are passed to `url_for`. # Make sure to yield (calls the next around filter if present and # eventually `url_for` on the controller): - returning yield do |result| + yield.tap do |result| # You can change the generated url_or_path here. Make sure to use # one of the "in-place" modifying String methods though (like sub! # and friends). diff --git a/vendor/plugins/i18n/lib/routing_filter/routing_filter.rb b/vendor/plugins/i18n/lib/routing_filter/routing_filter.rb index c452988ef1..ef6ac3272b 100644 --- a/vendor/plugins/i18n/lib/routing_filter/routing_filter.rb +++ b/vendor/plugins/i18n/lib/routing_filter/routing_filter.rb @@ -47,7 +47,7 @@ def generate_optimisation_block_with_filtering(*args) if match = code.match(%r(^return (.*) if (.*))) # returned string must not contain newlines, or we'll spill out of inline code comments in # ActionController::Routing::RouteSet::NamedRouteCollection#define_url_helper - "returning(#{match[1]}) { |result|" + + "#{match[1]}.tap { |result|" + " ActionController::Routing::Routes.filters.run_reverse(:around_generate, *args, &lambda{ result }) " + "} if #{match[2]}" end @@ -85,7 +85,7 @@ def generate_with_filtering(*args) # TODO move this ... where? alias_method :extract_request_environment_without_host, :extract_request_environment unless method_defined? :extract_request_environment_without_host def extract_request_environment(request) - returning extract_request_environment_without_host(request) do |env| + extract_request_environment_without_host(request).tap do |env| env.merge! :host => request.host, :port => request.port, :host_with_port => request.host_with_port, diff --git a/vendor/plugins/i18n/lib/routing_filter/routing_filter/force_extension.rb b/vendor/plugins/i18n/lib/routing_filter/routing_filter/force_extension.rb index c004a22f44..d33385a346 100644 --- a/vendor/plugins/i18n/lib/routing_filter/routing_filter/force_extension.rb +++ b/vendor/plugins/i18n/lib/routing_filter/routing_filter/force_extension.rb @@ -16,7 +16,7 @@ def around_recognize(path, env, &block) end def around_generate(*args, &block) - returning yield do |result| + yield.tap do |result| url = result.is_a?(Array) ? result.first : result append_extension!(url) if append_extension?(url) end diff --git a/vendor/plugins/i18n/lib/routing_filter/routing_filter/pagination.rb b/vendor/plugins/i18n/lib/routing_filter/routing_filter/pagination.rb index 0af9688d47..738be097e8 100644 --- a/vendor/plugins/i18n/lib/routing_filter/routing_filter/pagination.rb +++ b/vendor/plugins/i18n/lib/routing_filter/routing_filter/pagination.rb @@ -4,14 +4,14 @@ module RoutingFilter class Pagination < Base def around_recognize(path, env, &block) page = extract_page!(path) - returning yield(path, env) do |params| + yield.tap(path, env) do |params| params[:page] = page.to_i if page end end def around_generate(*args, &block) page = args.extract_options!.delete(:page) - returning yield do |result| + yield.tap do |result| if page && page != 1 url = result.is_a?(Array) ? result.first : result append_page!(url, page) diff --git a/vendor/plugins/i18n/lib/routing_filter/routing_filter/uuid_token.rb b/vendor/plugins/i18n/lib/routing_filter/routing_filter/uuid_token.rb index fa58c1ad34..508c978aef 100644 --- a/vendor/plugins/i18n/lib/routing_filter/routing_filter/uuid_token.rb +++ b/vendor/plugins/i18n/lib/routing_filter/routing_filter/uuid_token.rb @@ -47,7 +47,7 @@ class UuidToken < Base def around_recognize(path, env, &block) token = extract_token!(path) # remove the token from the beginning of the path - returning yield do |params| # invoke the given block (calls more filters and finally routing) + yield.tap do |params| # invoke the given block (calls more filters and finally routing) params[:uuid_token] = token if token # set recognized token to the resulting params hash end end @@ -56,7 +56,7 @@ def around_generate(*args, &block) token = args.extract_options!.delete(:uuid_token) # extract the passed :token option token = AccessToken.current if AccessToken && token.nil? # default to AccessToken.current when token is nil (could also be false) - returning yield do |result| + yield.tap do |result| if token url = result.is_a?(Array) ? result.first : result prepend_token!(url, token)