factbase 0.0.59 → 0.0.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/factbase/terms/strings.rb +2 -2
- data/lib/factbase.rb +1 -1
- data/test/factbase/terms/test_strings.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebfb3fe82bdf543291f6fd7630c2b69deb3949e6788b79d85c5d58ea733240b3
|
4
|
+
data.tar.gz: 38d05a0630a444f8a77e67b96a3f90aa213ec5f47b764c25401fd90320449ae7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29f84d7e12a5cd5b4260590cc40f0a74afa500bec5aaad9f8f3e2c0673fc7864ef9a7c7ac30d08bd5015c3fb87f23cf7123b2ae54306ba58d15c0d0d834f350c
|
7
|
+
data.tar.gz: 1aab5b40d3f47148377d302284af4bed085580bafb4de9acc7b3b9c602e502bdfd3814063095c33f80f63439fe213d190aa9067c55e93c00662f1c3556aa8287
|
@@ -29,12 +29,12 @@ require_relative '../../factbase'
|
|
29
29
|
# License:: MIT
|
30
30
|
module Factbase::Term::Strings
|
31
31
|
def concat(fact, maps)
|
32
|
-
(0..@operands.length - 1).map { |i| the_values(i, fact, maps)
|
32
|
+
(0..@operands.length - 1).map { |i| the_values(i, fact, maps)&.first }.join
|
33
33
|
end
|
34
34
|
|
35
35
|
def sprintf(fact, maps)
|
36
36
|
fmt = the_values(0, fact, maps)[0]
|
37
|
-
ops = (1..@operands.length - 1).map { |i| the_values(i, fact, maps)
|
37
|
+
ops = (1..@operands.length - 1).map { |i| the_values(i, fact, maps)&.first }
|
38
38
|
format(*([fmt] + ops))
|
39
39
|
end
|
40
40
|
|
data/lib/factbase.rb
CHANGED
@@ -81,7 +81,7 @@ require 'yaml'
|
|
81
81
|
# License:: MIT
|
82
82
|
class Factbase
|
83
83
|
# Current version of the gem (changed by .rultor.yml on every release)
|
84
|
-
VERSION = '0.0.
|
84
|
+
VERSION = '0.0.60'
|
85
85
|
|
86
86
|
# An exception that may be thrown in a transaction, to roll it back.
|
87
87
|
class Rollback < StandardError; end
|
@@ -29,8 +29,9 @@ require_relative '../../../lib/factbase/term'
|
|
29
29
|
# License:: MIT
|
30
30
|
class TestStrings < Minitest::Test
|
31
31
|
def test_concat
|
32
|
-
t = Factbase::Term.new(:concat, [42, 'hi', 3.14, Time.now])
|
33
|
-
|
32
|
+
t = Factbase::Term.new(:concat, [42, 'hi', 3.14, :hey, Time.now])
|
33
|
+
s = t.evaluate(fact, [])
|
34
|
+
assert(s.start_with?('42hi3.14'), s)
|
34
35
|
end
|
35
36
|
|
36
37
|
def test_concat_empty
|
@@ -39,7 +40,7 @@ class TestStrings < Minitest::Test
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def test_sprintf
|
42
|
-
t = Factbase::Term.new(:sprintf, ['hi, %s!', 'Jeff'])
|
43
|
+
t = Factbase::Term.new(:sprintf, ['hi, %s!', 'Jeff', :hey])
|
43
44
|
assert_equal('hi, Jeff!', t.evaluate(fact, []))
|
44
45
|
end
|
45
46
|
|