Permalink
Browse files

Object#returning has been removed from rasil3 in favor of Object#tap

  • Loading branch information...
1 parent 50889fa commit e3d12dd6262925cc2deac862704b3a08c8d1f31f @jtgeibel jtgeibel committed Mar 27, 2011
@@ -248,7 +248,7 @@ def feed_icon_tag(title, url)
end
def search_posts_title
- returning(params[:q].blank? ? :recent_posts.l : :searching_for.l+" '#{h params[:q]}'") do |title|
+ (params[:q].blank? ? :recent_posts.l : :searching_for.l+" '#{h params[:q]}'").tap do |title|
title << " by #{h User.find(params[:user_id]).display_name}" if params[:user_id]
title << " in #{h Forum.find(params[:forum_id]).name}" if params[:forum_id]
end
@@ -79,7 +79,7 @@ def get_plugins_to_migrate(plugin_names)
# plugin names involved is shorter than 230 characters that one will be
# used. Otherwise a shorter name will be returned.
def build_migration_name
- returning descriptive_migration_name do |name|
+ descriptive_migration_name.tap do |name|
name.replace short_migration_name if name.length > MAX_FILENAME_LENGTH
end
end
@@ -138,7 +138,7 @@ def test_should_be_deleted_when_user_destroyed
protected
def create_post(topic, options = {})
- returning topic.sb_posts.new(options) do |p|
+ topic.sb_posts.new(options).tap do |p|
p.user = users(:aaron)
p.save!
end
@@ -76,7 +76,7 @@ class << self
# tag_list = TagList.from("One , Two, Three")
# tag_list # ["One", "Two", "Three"]
def from(string)
- returning new do |tag_list|
+ new.tap do |tag_list|
string = string.to_s.gsub('.', '').dup
[
@@ -29,7 +29,7 @@ def white_list(html, options = {})
return html if html.blank? || !html.include?('<')
(options[:attributes] ||= {}).update(white_listed_attributes)
(options[:tags] ||= []).push(*options[:attributes].keys).push(*white_listed_tags).uniq!
- returning [] do |new_text|
+ [].tap do |new_text|
tokenizer = HTML::Tokenizer.new(html)
while token = tokenizer.next

0 comments on commit e3d12dd

Please sign in to comment.