easy_template 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/easy_template.rb +1 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e329d8b97804b7d7355033d9f7ee16ec9387aa6
4
- data.tar.gz: 2450f2f375b1190801d9827ee917a0ec72c4f8e5
3
+ metadata.gz: 6a7054ff14913709b73c6e3a795f21f833ea07ec
4
+ data.tar.gz: 54bbec86ea4153e775d527270aec2506feb5a110
5
5
  SHA512:
6
- metadata.gz: 3211675cc558a2955a2742174fadd68c81a917a688d9a51a0627370d204ffdda4722b5061a41f9f52c871e051dab3769085db10ebf8e678dfaeacf34a856a6b8
7
- data.tar.gz: 075a3a2eda6fb116c9de2c8df09e893e3973fa8274857c980b8840ca1d23a30ca390fb9e19ed134b02833fc500a53b977b59535f7df1d78b8cbd7fde23bb2b1d
6
+ metadata.gz: 09e24d3d7eaad088044d0581ad991f20cb27fb4796665d1f79174d52d564a6f65b727f5a7915d02ff6645e72bb81e3bb03a1d889c8d20108c427b55c661cfe8b
7
+ data.tar.gz: 3f9abc8b38896a0e3253ba5f8814b6bc56eca771c443426992b1d3999f51c913f24e21e8cf6bb1daec2f62fdf91484bc356a1b83212002b2f0eaf7f2697c7342
data/lib/easy_template.rb CHANGED
@@ -5,6 +5,6 @@ module EasyTemplate
5
5
  # variables: (Hash)
6
6
  # the hash containing the values to substitute in place of the keys enclosed by { and }.
7
7
  def self.process(text, variables)
8
- text.gsub(/(\\\{)|((?<!\\)(?:\\\\)*#{variables.map{|v|"\\{#{v[0]}\\}"}.join('|')})/i){|s| s[0] == '\\' ? s[1] : variables[s[1..-2]]}
8
+ text.gsub(/(\\\{)|((?<!\\)(?:\\\\)*#{variables.map{|v|"\\{#{Regexp.escape(v[0])}\\}"}.join('|')})/i){|s| s[0] == '\\' ? s[1] : variables[s[1..-2]]}
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jérémy Lecerf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-12 00:00:00.000000000 Z
11
+ date: 2016-05-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Easy template language in ruby, with only variable substitution.
14
14
  email: redpist.com@gmail.com