Skip to content

Commit

Permalink
add poor man's html_safe? implementation (not required automatically)
Browse files Browse the repository at this point in the history
  • Loading branch information
minad committed Sep 7, 2014
1 parent 6891493 commit 0e41e63
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/temple/html_safe.rb
@@ -0,0 +1,21 @@
module Temple
class HtmlSafe < String
def html_safe?; true end
def html_safe; self end
def to_s; self end
end
end

class Object
def html_safe?; false end
end

class Numeric
def html_safe?; true end
end

class String
def html_safe
Temple::HtmlSafe.new(self)
end
end

0 comments on commit 0e41e63

Please sign in to comment.