Skip to content
Browse files

placeholdit alias' placeholdit_image_tag

  • Loading branch information...
1 parent 270d364 commit 317135bbfffd97f60741506f14a21148226c4c8b @ohokay committed Apr 11, 2012
Showing with 10 additions and 0 deletions.
  1. +4 −0 README.md
  2. +2 −0 lib/placeholdit.rb
  3. +4 −0 spec/placeholdit_spec.rb
View
4 README.md
@@ -34,6 +34,10 @@ The same placeholder image with a blue background and red text (not recommended)
$ <%= placeholdit_image_tag "500", text: "Buy me!", background_color: '#004eff', text_color: '#ff0000' %>
+Alternatively, calling placeholdit will work as well:
+
+ $ <%= placeholdit "500" %>
+
## Contributing
View
2 lib/placeholdit.rb
@@ -30,6 +30,8 @@ def placeholdit_image_tag(size, opts={})
image_tag
end
+ alias :placeholdit :placeholdit_image_tag
+
private
def remove_hex_pound(str)
View
4 spec/placeholdit_spec.rb
@@ -34,4 +34,8 @@ class MyView
view.placeholdit_image_tag("500", text_color: 'ffffff', background_color: '#000000').should == "<img src='http://placehold.it/500/000000/ffffff' alt='A placeholder image' class='placeholder' height='500' width='500' />"
end
+ it "should alias to placeholdit" do
+ view.placeholdit("500", text_color: 'fff', background_color: '000').should == "<img src='http://placehold.it/500/000/fff' alt='A placeholder image' class='placeholder' height='500' width='500' />"
+ end
+
end

0 comments on commit 317135b

Please sign in to comment.
Something went wrong with that request. Please try again.