This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HTML | |
class StathamSanitizer < WhiteListSanitizer | |
protected | |
def tokenize(text, options) | |
super.map do |token| | |
if token.is_a?(HTML::Tag) && options[:parent].include?(token.name) | |
token.to_s.gsub(/</, "<") | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'resource_path' | |
require 'redirect_check' | |
require 'test/unit' | |
class HTTPRedirectTest < Test::Unit::TestCase | |
def default_test; end # placeholder to stop Test::Unit from complaining | |
def self.domain=(domain) | |
RedirectCheck.domain = domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
def truthy? | |
!(self.nil? || | |
self == false || | |
self == 0 || | |
self == '0' || | |
self == '' || | |
self == [] || | |
self == { } ) | |
end |