lib/it/link.rb in it-0.2.5 vs lib/it/link.rb in it-0.8.0
- old
+ new
@@ -1,18 +1,19 @@
module It
# A class for links
class Link < Tag
include ActionView::Helpers::UrlHelper
-
+
# See It.link for details. You can do everything there and save 6 characters.
def initialize(href, options = {})
- raise TypeError, "Invalid href given" unless href.is_a?(Hash) || href.is_a?(String)
+ fail TypeError, 'Invalid href given' unless [Hash, String].include?(href.class)
+
super(:a, options)
@href = href
end
-
+
# Will be called from inside the helper to return the tag with the given content.
def process(content)
link_to(content, @href, @options)
end
end
-end
\ No newline at end of file
+end