condensation 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 100a7ec169473d6bc18ceebf8e459dd81fa74efb
4
- data.tar.gz: 359b33cebf4f95b71a70b3afd670cb7965881344
3
+ metadata.gz: 760318c47617620c742ac22ed0517be0475048f4
4
+ data.tar.gz: eea54bd7785eee3024a5e6e5dd00ba1976149366
5
5
  SHA512:
6
- metadata.gz: f58303213c28f48e3bf7edbfac7be3c1fced506610676592e69a1884521278046e30548f5e723830e0122f3d9a560c98e7ae4f2413e638222aaf8e9cfe4433cc
7
- data.tar.gz: 4148402c80d022dc40e28152dd38e763df026f587c77948440009a4597c4bda3f0b125daf5dce3d405a792bf7737241ecb483f8e0ac7fabe7536f3fd69617324
6
+ metadata.gz: f4a22ba563281a17cc06638a010b400b07db726e81490dc16a19329d301f03c8a40c409f0be2b08601f114bc4e871b3bb8ca479cce74bdcc774fa8450eb03692
7
+ data.tar.gz: 783bc3a8afee5244217be2588ab01c3c92545e8e35dde533f5ca181814fc40d92f40690d4b4fa43aaeaad90156ebe8fdb0dd7d5756e19eca5de1bce524274cba
@@ -0,0 +1,9 @@
1
+ module Condensation
2
+ module Filters
3
+ module UrlEncode
4
+ def url_encode(input)
5
+ CGI.escape(input) rescue input
6
+ end
7
+ end
8
+ end
9
+ end
@@ -2,4 +2,5 @@ require "condensation/filters/default"
2
2
  require "condensation/filters/hyperlink"
3
3
  require "condensation/filters/replace_inner_html"
4
4
  require "condensation/filters/days_since"
5
- require "condensation/filters/days_until"
5
+ require "condensation/filters/days_until"
6
+ require "condensation/filters/url_encode"
@@ -1,3 +1,3 @@
1
1
  module Condensation
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
+
3
+ describe Condensation::Filters::UrlEncode do
4
+ def render_with_filter(template, context)
5
+ template.render(context, :filters => [Condensation::Filters::UrlEncode])
6
+ end
7
+
8
+ describe "#url_encode" do
9
+ it "encode the input" do
10
+ email = "derrick+1@example.com"
11
+ template = Liquid::Template.parse("{{ email | url_encode }}")
12
+ result = render_with_filter(template, { "email" => email })
13
+ result.must_equal "derrick%2B1%40example.com"
14
+ end
15
+
16
+ it "should handle nil values" do
17
+ email = nil
18
+ template = Liquid::Template.parse("{{ email | url_encode }}")
19
+ result = render_with_filter(template, { "email" => email })
20
+ result.must_equal ""
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: condensation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derrick Reimer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-28 00:00:00.000000000 Z
11
+ date: 2014-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -106,6 +106,7 @@ files:
106
106
  - lib/condensation/filters/default.rb
107
107
  - lib/condensation/filters/hyperlink.rb
108
108
  - lib/condensation/filters/replace_inner_html.rb
109
+ - lib/condensation/filters/url_encode.rb
109
110
  - lib/condensation/sanitizer.rb
110
111
  - lib/condensation/version.rb
111
112
  - spec/condensation/filters/days_since_spec.rb
@@ -113,6 +114,7 @@ files:
113
114
  - spec/condensation/filters/default_spec.rb
114
115
  - spec/condensation/filters/hyperlink_spec.rb
115
116
  - spec/condensation/filters/replace_inner_html_spec.rb
117
+ - spec/condensation/filters/url_encode_spec.rb
116
118
  - spec/condensation/sanitizer_spec.rb
117
119
  - spec/condensation_spec.rb
118
120
  - spec/spec_helper.rb
@@ -146,6 +148,7 @@ test_files:
146
148
  - spec/condensation/filters/default_spec.rb
147
149
  - spec/condensation/filters/hyperlink_spec.rb
148
150
  - spec/condensation/filters/replace_inner_html_spec.rb
151
+ - spec/condensation/filters/url_encode_spec.rb
149
152
  - spec/condensation/sanitizer_spec.rb
150
153
  - spec/condensation_spec.rb
151
154
  - spec/spec_helper.rb