condensation 1.0.4 → 1.0.5

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: df472b373af40dc03b8b66d059e79cd488c0348f
4
- data.tar.gz: 89e3091703cc6c23ae96c8ef5c3b3a1254a1fb0a
3
+ metadata.gz: a393d9eb0299b23e66c0c038680659d49c11fff8
4
+ data.tar.gz: ee168fe8b748bf9b35768588f031516c0d12fad9
5
5
  SHA512:
6
- metadata.gz: ce2234738506aa8eca12c753af13830f3ea4af5e79126aeef01d85c4e539f4b13d4e79fe4341ed1d810cbe620acb921c18cd273d5806be20f21791e19803c551
7
- data.tar.gz: df4db23c5992d2ef03148be6dd65edb4fe3b50ac1b437088b6920e334e9660339de3457104b86c9da6fa7d1806c49bcc67e940bfab0f2920e8f958e0990054ec
6
+ metadata.gz: 8477f1b77f70c36435754c7cc6afeb605fe1305f882582bbca5f1402e800a89123f980abfe87ca961233ab8c66b6abe6b2a9fdf2c1d66dc04ab5262aab8b2149
7
+ data.tar.gz: d83ee28d60416959410dd61e4fc17094c465ccba94c6f324b17cf015454293e3bd12bd7859d9984afa9e3ede0b8d976696f9955384c3c7b89dee70070956a0ed
@@ -0,0 +1,10 @@
1
+ module Condensation
2
+ module Filters
3
+ module StripCommas
4
+ def strip_commas(input)
5
+ return if input.nil?
6
+ input.gsub(",", "")
7
+ end
8
+ end
9
+ end
10
+ end
@@ -3,4 +3,5 @@ require "condensation/filters/hyperlink"
3
3
  require "condensation/filters/replace_inner_html"
4
4
  require "condensation/filters/days_since"
5
5
  require "condensation/filters/days_until"
6
- require "condensation/filters/url_encode"
6
+ require "condensation/filters/url_encode"
7
+ require "condensation/filters/strip_commas"
@@ -1,3 +1,3 @@
1
1
  module Condensation
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
data/lib/condensation.rb CHANGED
@@ -10,7 +10,8 @@ module Condensation
10
10
  Filters::ReplaceInnerHTML,
11
11
  Filters::DaysSince,
12
12
  Filters::DaysUntil,
13
- Filters::UrlEncode
13
+ Filters::UrlEncode,
14
+ Filters::StripCommas
14
15
  ]
15
16
 
16
17
  def self.register_filters
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
+
3
+ describe Condensation::Filters::StripCommas do
4
+ def render_with_filter(template, context)
5
+ template.render(context, :filters => [Condensation::Filters::StripCommas])
6
+ end
7
+
8
+ describe "#strip_commas" do
9
+ it "remove commas" do
10
+ tag = "foo, bar, bop"
11
+ template = Liquid::Template.parse("{{ tag | strip_commas }}")
12
+ result = render_with_filter(template, { "tag" => tag })
13
+ result.must_equal "foo bar bop"
14
+ end
15
+
16
+ it "should handle nil values" do
17
+ tag = nil
18
+ template = Liquid::Template.parse("{{ tags | strip_commas }}")
19
+ result = render_with_filter(template, { "tag" => tag })
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.4
4
+ version: 1.0.5
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-06-02 00:00:00.000000000 Z
11
+ date: 2015-02-12 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/strip_commas.rb
109
110
  - lib/condensation/filters/url_encode.rb
110
111
  - lib/condensation/sanitizer.rb
111
112
  - lib/condensation/version.rb
@@ -114,6 +115,7 @@ files:
114
115
  - spec/condensation/filters/default_spec.rb
115
116
  - spec/condensation/filters/hyperlink_spec.rb
116
117
  - spec/condensation/filters/replace_inner_html_spec.rb
118
+ - spec/condensation/filters/strip_commas_spec.rb
117
119
  - spec/condensation/filters/url_encode_spec.rb
118
120
  - spec/condensation/sanitizer_spec.rb
119
121
  - spec/condensation_spec.rb
@@ -137,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
139
  version: '0'
138
140
  requirements: []
139
141
  rubyforge_project:
140
- rubygems_version: 2.0.3
142
+ rubygems_version: 2.3.0
141
143
  signing_key:
142
144
  specification_version: 4
143
145
  summary: Condensation is a collection of handy extensions to the Liquid templating
@@ -148,7 +150,9 @@ test_files:
148
150
  - spec/condensation/filters/default_spec.rb
149
151
  - spec/condensation/filters/hyperlink_spec.rb
150
152
  - spec/condensation/filters/replace_inner_html_spec.rb
153
+ - spec/condensation/filters/strip_commas_spec.rb
151
154
  - spec/condensation/filters/url_encode_spec.rb
152
155
  - spec/condensation/sanitizer_spec.rb
153
156
  - spec/condensation_spec.rb
154
157
  - spec/spec_helper.rb
158
+ has_rdoc: