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.
- checksums.yaml +4 -4
- data/lib/easy_template.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8b5b0e563bf700d470a3773d68ebface55bf5a8
|
4
|
+
data.tar.gz: c984f995d0dea6692b5ffe92319f12ff6376aece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03a7a21932d0624d51a78663ee5de3669c6cc252f2a592aaa31cb2abc39076d554279a4be96228e6ec356ad4c74f90d906f4c6088812b953750c37d8c579f0d8
|
7
|
+
data.tar.gz: 107b5bf7ce4e0c4a750afcd0d5eda9c7a5c2e939c594b9bf1d6b30d7c1bdf91580eee1999243581f63a8a3f91b90b50fafbf638ffb565e3db48ba94b964f4509
|
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|"\\{#{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.
|
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-
|
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
|