easy_template 1.0.2 → 1.0.3

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: 64744b1df5039fa65bbfb32a41becfa16ac8f07e
4
- data.tar.gz: cbec45cbecbfc53399796a3bc6c17b6fffdd86c5
3
+ metadata.gz: d8b5b0e563bf700d470a3773d68ebface55bf5a8
4
+ data.tar.gz: c984f995d0dea6692b5ffe92319f12ff6376aece
5
5
  SHA512:
6
- metadata.gz: d8cee0ede574fe5b39e99dd14f4a070b3ab1d6a29040cf3c541b30219cee516bbc473c3ac874e902f206b6d88c5f6139bbc0d1b63b9a547da99f0dd25b879ac2
7
- data.tar.gz: 6e948bf302f4908f0b9baf6ef8ea4defc3606bce020180b10550203c8606dd900568d33e3d36e4ef50bd6d48b0f9657c386a7db1bb7db7b6b1230cbb153fc5f8
6
+ metadata.gz: 03a7a21932d0624d51a78663ee5de3669c6cc252f2a592aaa31cb2abc39076d554279a4be96228e6ec356ad4c74f90d906f4c6088812b953750c37d8c579f0d8
7
+ data.tar.gz: 107b5bf7ce4e0c4a750afcd0d5eda9c7a5c2e939c594b9bf1d6b30d7c1bdf91580eee1999243581f63a8a3f91b90b50fafbf638ffb565e3db48ba94b964f4509
@@ -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|"\\{#{Regexp.escape(v[0])}\\}"}.join('|')})/i){|s| s[0] == '\\' ? s[1] : variables[s[1..-2].downcase]}
8
+ text.gsub(/(\\\{)|((?<!\\)(?:\\\\)*#{variables.map{|v|"\\{#{Regexp.escape(v[0])}\\}"}.join('|')})/i){|s| s[0] == '\\' ? s[1] : variables[s[1..-2].try(:downcase)].to_s}
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.2
4
+ version: 1.0.3
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-08-09 00:00:00.000000000 Z
11
+ date: 2016-11-07 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