parsecs 0.11.4 → 0.11.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/parsec.rb +4 -2
  3. data/test/test_parsec.rb +2 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f31334656fdb4d48c312b6adabb100f74750060454bd21865d35594a340923af
4
- data.tar.gz: bfab768c82d4b69dcaf018b63017c1027bd648a6ca4ad036fc4a32b100f41b60
3
+ metadata.gz: df4539b513e63438ad85c1de1e92742fec4c5c8ddca1966d6848cb99f68f8ae3
4
+ data.tar.gz: ff664c712a7c6ce57f532f0dc42d5d0a8b787b99a794c1ed97b2d6c6fb390478
5
5
  SHA512:
6
- metadata.gz: e67b9d458d4c15c4cc2dde06646ff019d9b8154b75546fb816781a92cf34c71f4d051d23b989799bba4ca0a443ed3c5b233ae4ffdb6c5c53b99e0b02583c8557
7
- data.tar.gz: bf3f8a89c3e61852edef6ce8b2489356f9681d362f6709f568969eda34575de35282df78b27cee17010a2ce562e7d9604aef28b11ab3912309e6356fcd231a67
6
+ metadata.gz: 34a1ac857f98619aff93b054faa23b7326b83172413709273e621130a7b5c00a98d0990fc1e3d3472a101ac64b3023ee512134575644989c00ad6475f685d371
7
+ data.tar.gz: a05281849a525fe6937e258544e7c3115dddaccc64ec63818aec17b81d8e2cc1ed9888a1a54cb4f3eecf88666214665a950b31e87c2c32715e2506d6cd0a4c87
data/lib/parsec.rb CHANGED
@@ -6,7 +6,7 @@ module Parsec
6
6
  class Parsec
7
7
  using StringToBooleanRefinements
8
8
 
9
- VERSION = '0.11.4'.freeze
9
+ VERSION = '0.11.5'.freeze
10
10
 
11
11
  # evaluates the equation and returns only the result
12
12
  def self.eval_equation(equation)
@@ -49,7 +49,9 @@ module Parsec
49
49
 
50
50
  # The following regex remove all spaces that are not between quot marks
51
51
  # https://tinyurl.com/ybc7bng3
52
- equation = equation.gsub(/( |(".*?[^\\]"))/, '\\2') if new_line == true
52
+ if new_line == true
53
+ equation.gsub!(/( |("([^"\\]|\\.)*")|('([^'\\]|\\.)*'))/, '\\2')
54
+ end
53
55
 
54
56
  equation
55
57
  end
data/test/test_parsec.rb CHANGED
@@ -56,6 +56,8 @@ class TestParsec < Minitest::Test
56
56
  assert_equal('TEST STRING', parser.eval_equation('toupper("test string")'))
57
57
  assert_equal('test string', parser.eval_equation('tolower("TEST STRING")'))
58
58
  assert_equal('Hello World', parser.eval_equation('concat("Hello ", "World")'))
59
+ assert_equal('Hello World', parser.eval_equation('concat("", "Hello World")'))
60
+ assert_equal('Hello World', parser.eval_equation('concat("Hello World", "")'))
59
61
  assert_equal('tes t "str \" " ing equa " tion', parser.eval_equation('concat(concat("tes t", " \\"str \\\\\" \\" ing "),string("equa \\" tion"))'))
60
62
  assert_equal(5, parser.eval_equation('str2number("5")'))
61
63
  assert_equal(5, parser.eval_equation('number("5")'))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsecs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4
4
+ version: 0.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nilton Vasques
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-09-29 00:00:00.000000000 Z
13
+ date: 2022-10-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest