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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dd4424b79963258ea77a3734a26c4cd194b1ac5dfad75a477ac3895b55e9670
4
- data.tar.gz: c19bdf30ba96aac04bdbbb3bb6ed865628df14e603fca28e2be603a65da2a351
3
+ metadata.gz: 4fb166c32bc6cf7c79dd6e1743329312c9a922efc1cfb111a00cc3d87cac9c41
4
+ data.tar.gz: 284f096cf17419c0688b36d000e77350580fb7f3ce7ad3ad221e6e1589e1ab4c
5
5
  SHA512:
6
- metadata.gz: ba860b7dda88832c4ff30bfe8ec1ac0ab0fe7fba3b037e25a88141b6756734197f6355c07d8001611980dc5cba989d05bd74ef62842d8aba1883c8ecd32b94ce
7
- data.tar.gz: 35c7d530ebd9a4393b7255a84887330fcc1f8be8f5e79ba8872e2aaac035aef1d8e8e824c4bce25b0fcd5f8e4d40fdb23a31d16cf98f8128f3e0d7720ea18bfa
6
+ metadata.gz: 3d294d5f00bd9f474585eb25392122a355e4202b99a4d62045e5237880c7835d555b8cd43b07c3791d0471c98c32587a7491d05aab14fcbd50daf0cd2268c958
7
+ data.tar.gz: 38785eb41a2a7c28a421e8d0be54bd6cda5bf042503d9b31c2c3141a163877b68433141307520ab4cf666a5762f3c0f2b66d951ba03102374eec51a6531c500b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- code-ruby (0.10.2)
4
+ code-ruby (0.10.3)
5
5
  activesupport (~> 7)
6
6
  bigdecimal (~> 3)
7
7
  json (~> 2)
@@ -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[:statement]
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
@@ -20,7 +20,7 @@ class Code
20
20
  end
21
21
 
22
22
  def root
23
- present | whitespace?.then { [] }
23
+ present | whitespace?.aka(:whitespace).then { [] }
24
24
  end
25
25
  end
26
26
  end
data/lib/code/version.rb CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require_relative "../code"
4
4
 
5
- Code::Version = Gem::Version.new("0.10.3")
5
+ Code::Version = Gem::Version.new("0.10.4")
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
- ["2.days.ago.past?", "true"],
150
- ["2.days.from_now.past?", "false"],
151
- ["2.days.ago.future?", "false"],
152
- ["2.days.from_now.future?", "true"],
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))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié