code-ruby 0.10.3 → 0.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/code/node/while.rb +3 -1
- data/lib/code/parser/code.rb +1 -1
- data/lib/code/version.rb +1 -1
- data/spec/code_spec.rb +4 -4
- 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: 4fb166c32bc6cf7c79dd6e1743329312c9a922efc1cfb111a00cc3d87cac9c41
|
4
|
+
data.tar.gz: 284f096cf17419c0688b36d000e77350580fb7f3ce7ad3ad221e6e1589e1ab4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d294d5f00bd9f474585eb25392122a355e4202b99a4d62045e5237880c7835d555b8cd43b07c3791d0471c98c32587a7491d05aab14fcbd50daf0cd2268c958
|
7
|
+
data.tar.gz: 38785eb41a2a7c28a421e8d0be54bd6cda5bf042503d9b31c2c3141a163877b68433141307520ab4cf666a5762f3c0f2b66d951ba03102374eec51a6531c500b
|
data/Gemfile.lock
CHANGED
data/lib/code/node/while.rb
CHANGED
@@ -9,7 +9,9 @@ class Code
|
|
9
9
|
|
10
10
|
def initialize(parsed)
|
11
11
|
@operator = parsed.delete(:operator)
|
12
|
-
@statement = Statement.new(parsed.delete(:statement)) if parsed[
|
12
|
+
@statement = Statement.new(parsed.delete(:statement)) if parsed[
|
13
|
+
:statement
|
14
|
+
]
|
13
15
|
@body = Code.new(parsed.delete(:body))
|
14
16
|
super(parsed)
|
15
17
|
end
|
data/lib/code/parser/code.rb
CHANGED
data/lib/code/version.rb
CHANGED
data/spec/code_spec.rb
CHANGED
@@ -146,10 +146,10 @@ RSpec.describe Code do
|
|
146
146
|
["a = 0 [1, 2, 3].each { |i| next if i == 2 a += i } a", "4"],
|
147
147
|
["[1, 2, 3].map { |i| next if i == 2 i ** 2}", "[1, nothing, 9]"],
|
148
148
|
["[1, 2, 3].map { |i| next(0) if i.even? i ** 2}", "[1, 0, 9]"],
|
149
|
-
[
|
150
|
-
[
|
151
|
-
[
|
152
|
-
[
|
149
|
+
%w[2.days.ago.past? true],
|
150
|
+
%w[2.days.from_now.past? false],
|
151
|
+
%w[2.days.ago.future? false],
|
152
|
+
%w[2.days.from_now.future? true]
|
153
153
|
].each do |input, expected|
|
154
154
|
it "#{input} == #{expected}" do
|
155
155
|
expect(Code.evaluate(input)).to eq(Code.evaluate(expected))
|