Skip to content

Commit 663fd5a

Browse files
committed
initial license, changelog, readme and version
1 parent 6de3911 commit 663fd5a

4 files changed

Lines changed: 84 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Changelog
2+
3+
## 0.1.0 (June 8th, 2010)
4+
* initial release

MIT-LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2010 Brian Lopez - http://github.com/brianmario
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.rdoc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
= escape_utils
2+
3+
Being as though we're all html escaping everything these days, why not make it faster?
4+
5+
At the moment escape_utils supports escaping and unescaping of HTML, but I wanna add URL encoding soon
6+
7+
It has monkey-patches for Rack::Utils, CGI, ERB::Util and Haml
8+
9+
== Installing
10+
11+
gem install escape_utils
12+
13+
== Usage
14+
15+
=== Escaping HTML
16+
17+
html = `curl -s http://maps.google.com`
18+
escaped_html = EscapeUtils.escape_html(html)
19+
20+
=== Unescaping HTML
21+
22+
html = `curl -s http://maps.google.com`
23+
escaped_html = EscapeUtils.escape_html(html)
24+
html = EscapeUtils.unescape_html(escaped_html)
25+
26+
=== Monkey Patches
27+
28+
require 'escape_utils/rack' # to patch Rack::Utils
29+
require 'escape_utils/erb' # to patch ERB::Util
30+
require 'escape_utils/cgi' # to patch CGI
31+
require 'escape_utils/haml' # to patch Haml::Helpers
32+
33+
== Benchmarks
34+
35+
In my testing, escaping is around 10-20x faster than the pure ruby implementations in wide use today.
36+
While unescaping is around 24x faster than CGI.unescapeHTML - also pure ruby.
37+
38+
This output is from my laptop using the benchmark scripts in the benchmarks folder.
39+
40+
=== Escaping
41+
42+
Rack::Utils.escape_html
43+
0.560000 0.040000 0.600000 ( 0.589475)
44+
ERB::Util.html_escape
45+
0.450000 0.040000 0.490000 ( 0.492893)
46+
CGI.escapeHTML
47+
0.460000 0.030000 0.490000 ( 0.490171)
48+
Haml::Helpers.html_escape
49+
0.430000 0.010000 0.440000 ( 0.444694)
50+
EscapeUtils.escape_html
51+
0.050000 0.010000 0.060000 ( 0.054799)
52+
53+
=== Unescaping
54+
55+
CGI.unescapeHTML
56+
1.140000 0.010000 1.150000 ( 1.148470)
57+
EscapeUtils.unescape_html
58+
0.040000 0.000000 0.040000 ( 0.046166)

escape_utils.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
Gem::Specification.new do |s|
77
s.name = %q{escape_utils}
8-
s.version = "0.0.1"
8+
s.version = "0.1.0"
99

1010
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
1111
s.authors = ["Brian Lopez"]
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
1818
"VERSION",
1919
"benchmark/escape.rb",
2020
"benchmark/unescape.rb",
21+
"escape_utils.gemspec",
2122
"ext/escape_utils.c",
2223
"ext/extconf.rb",
2324
"lib/escape_utils.rb",

0 commit comments

Comments
 (0)