pechkin 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 +4 -4
- data/lib/pechkin/message_template.rb +30 -1
- data/lib/pechkin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1676e5e77d5898b67a9614012f5d982cb2c75c97847ba8fe22bfaf409988f78
|
4
|
+
data.tar.gz: bd7a612a913ce4433ec8a4d78687f5eddb75b1cf28ca6675f33833b0ebc76955
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 806a857ddaf52ead16bbeec58bd1b9b4d3af8690011297fa35014058d3f0b1510ffa6694e4a651f33eab71814cae677b12d169df2c1a2fbd26eb57fd0f017169
|
7
|
+
data.tar.gz: c699ddf5ad93cc7e5c9996fa398d734a5029fef470311c488cfc0d3df4d7124e8bb7b02498e7e69e27ce64d8109f5bab27f264642feefba5dc5a7ab6947877d1
|
@@ -8,8 +8,37 @@ module Pechkin
|
|
8
8
|
|
9
9
|
# Message template to render final message.
|
10
10
|
class MessageTemplate
|
11
|
+
class << self
|
12
|
+
def ruby_v260_or_later?(ruby_version = RUBY_VERSION)
|
13
|
+
# Need to compare two versions, one is 2.6.0 - which supports keyword
|
14
|
+
# arguments in ERB#initialize. Everything below that should use legacy
|
15
|
+
# arguments
|
16
|
+
rb_v260 = [2, 6, 0]
|
17
|
+
rb_current = ruby_version.split('.').map(&:to_i)
|
18
|
+
|
19
|
+
rb_v260.zip(rb_current).each do |x, y|
|
20
|
+
x ||= 0
|
21
|
+
y ||= 0
|
22
|
+
return false if y < x
|
23
|
+
end
|
24
|
+
|
25
|
+
true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
RUBY_V260 = MessageTemplate.ruby_v260_or_later?
|
30
|
+
|
11
31
|
def initialize(erb)
|
12
|
-
|
32
|
+
# ERB#initialize has different signature starting from Ruby 2.6.*
|
33
|
+
# See link:
|
34
|
+
# https://github.com/ruby/ruby/blob/2311087/NEWS#stdlib-updates-outstanding-ones-only
|
35
|
+
if MessageTemplate::RUBY_V260
|
36
|
+
@erb_template = ERB.new(erb, trim_mode: '-')
|
37
|
+
else
|
38
|
+
safe_level = nil
|
39
|
+
trim_mode = '-'
|
40
|
+
@erb_template = ERB.new(erb, safe_level, trim_mode)
|
41
|
+
end
|
13
42
|
end
|
14
43
|
|
15
44
|
def render(data)
|
data/lib/pechkin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pechkin
|
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
|
- Ilya Arkhanhelsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|