code-ruby 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -4
- data/README.md +4 -0
- data/code-ruby.gemspec +1 -0
- data/lib/code/object/list.rb +7 -0
- data/lib/code/version.rb +1 -1
- data/spec/code/object/list_spec.rb +14 -0
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b63a5dc762c3ac1d5e2f37910c24806b092a78f0bc8ed5ad4409f2e6283f7880
|
4
|
+
data.tar.gz: 5cd2966db552e1b06a7946767af43005a670dbe76378e8680524af6abf3a2479
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d364133a93859542602ac10730d4b539e2e090e7b91fa9ffacfec1602edc5701da4ab8c6d1208e6e9a1967983ea2c62d80fbf7aab6df62141da332199ed7796
|
7
|
+
data.tar.gz: ad10fe135a0391fa37d769282b13a1fa7b1423a9226daa147553d91ee0d61f03f8b49d6e7b1c0514709bbf0cb03fe6c64db9ea7a71b10b9761cdcc1cdc95f2a1
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
code-ruby (0.6.
|
4
|
+
code-ruby (0.6.1)
|
5
|
+
bigdecimal (~> 3)
|
5
6
|
language-ruby (~> 0)
|
6
7
|
zeitwerk (~> 2)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
12
|
+
bigdecimal (3.1.6)
|
11
13
|
diff-lcs (1.5.0)
|
12
14
|
language-ruby (0.6.0)
|
13
15
|
zeitwerk (~> 2)
|
@@ -24,11 +26,12 @@ GEM
|
|
24
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
25
27
|
rspec-support (~> 3.12.0)
|
26
28
|
rspec-support (3.12.1)
|
27
|
-
ruby-prof (1.
|
29
|
+
ruby-prof (1.7.0)
|
28
30
|
zeitwerk (2.6.12)
|
29
31
|
|
30
32
|
PLATFORMS
|
31
|
-
arm64-darwin-
|
33
|
+
arm64-darwin-23
|
34
|
+
ruby
|
32
35
|
|
33
36
|
DEPENDENCIES
|
34
37
|
code-ruby!
|
@@ -36,4 +39,4 @@ DEPENDENCIES
|
|
36
39
|
ruby-prof
|
37
40
|
|
38
41
|
BUNDLED WITH
|
39
|
-
2.
|
42
|
+
2.5.5
|
data/README.md
CHANGED
data/code-ruby.gemspec
CHANGED
data/lib/code/object/list.rb
CHANGED
@@ -71,6 +71,9 @@ class Code
|
|
71
71
|
when "size"
|
72
72
|
sig(args)
|
73
73
|
code_size
|
74
|
+
when "sum"
|
75
|
+
sig(args)
|
76
|
+
code_sum
|
74
77
|
when "uniq"
|
75
78
|
sig(args)
|
76
79
|
code_uniq
|
@@ -197,6 +200,10 @@ class Code
|
|
197
200
|
List.new(raw.uniq)
|
198
201
|
end
|
199
202
|
|
203
|
+
def code_sum
|
204
|
+
raw.inject(&:code_plus) || Nothing.new
|
205
|
+
end
|
206
|
+
|
200
207
|
def inspect
|
201
208
|
to_s
|
202
209
|
end
|
data/lib/code/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
RSpec.describe Code::Object::List do
|
6
|
+
[
|
7
|
+
["[] == []", "true"],
|
8
|
+
["[1, 2, 3].sum", "6"],
|
9
|
+
].each do |input, expected|
|
10
|
+
it "#{input} == #{expected}" do
|
11
|
+
expect(Code.evaluate(input)).to eq(Code.evaluate(expected))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bigdecimal
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3'
|
41
55
|
description: 'A programming language, like Code.evaluate("1 + 1") # => 2'
|
42
56
|
email: dorian@dorianmarie.fr
|
43
57
|
executables:
|
@@ -154,6 +168,7 @@ files:
|
|
154
168
|
- spec/code/object/dictionary_spec.rb
|
155
169
|
- spec/code/object/function_spec.rb
|
156
170
|
- spec/code/object/integer_spec.rb
|
171
|
+
- spec/code/object/list_spec.rb
|
157
172
|
- spec/code/object/nothing_spec.rb
|
158
173
|
- spec/code/object/range_spec.rb
|
159
174
|
- spec/code/parser/boolean_spec.rb
|
@@ -188,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
203
|
- !ruby/object:Gem::Version
|
189
204
|
version: '0'
|
190
205
|
requirements: []
|
191
|
-
rubygems_version: 3.
|
206
|
+
rubygems_version: 3.5.5
|
192
207
|
signing_key:
|
193
208
|
specification_version: 4
|
194
209
|
summary: A programming language
|
@@ -199,6 +214,7 @@ test_files:
|
|
199
214
|
- spec/code/object/dictionary_spec.rb
|
200
215
|
- spec/code/object/function_spec.rb
|
201
216
|
- spec/code/object/integer_spec.rb
|
217
|
+
- spec/code/object/list_spec.rb
|
202
218
|
- spec/code/object/nothing_spec.rb
|
203
219
|
- spec/code/object/range_spec.rb
|
204
220
|
- spec/code/parser/boolean_spec.rb
|