language-ruby 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cherry.js +21 -0
- data/bin/publish +1 -1
- data/lib/code/object/string.rb +7 -0
- data/lib/code/ruby.rb +3 -3
- data/lib/template/version.rb +1 -1
- data/spec/code/string_spec.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '05749a98bba8a50630c8780cfc867dc9896c49dc02dde0b2866504a3e6d5470a'
|
4
|
+
data.tar.gz: 2b5f1a517e49e30f4f3a9c8d52faba2ddedad5a567473863fd3006e790b8018c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8be20c47524964786c35f409329fbdb23d6335d3b471247c4d08e747920129e1bc2980c830bdb8b3be24d0d16c9cf30311c95172e5e377dcaa0c1973fee75c05
|
7
|
+
data.tar.gz: 2db666b26767609eaa6793341d8f87ce426a5ec0ea42daa8fc59bf2d2c05ba8316d8c79ca31260c59bf021e22f8101493a3fbd9dfd21bcdb290b28e34b27db2e
|
data/.cherry.js
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module.exports = {
|
2
|
+
project_name: 'dorianmariefr/template-ruby',
|
3
|
+
metrics: [
|
4
|
+
{
|
5
|
+
name: 'todo',
|
6
|
+
pattern: /TODO:/i,
|
7
|
+
},
|
8
|
+
{
|
9
|
+
name: 'fixme',
|
10
|
+
pattern: /FIXME:/i,
|
11
|
+
},
|
12
|
+
{
|
13
|
+
name: 'rubocop',
|
14
|
+
pattern: /rubocop:disable/,
|
15
|
+
},
|
16
|
+
{
|
17
|
+
name: 'eslint',
|
18
|
+
pattern: /eslint-disable/,
|
19
|
+
},
|
20
|
+
],
|
21
|
+
}
|
data/bin/publish
CHANGED
data/lib/code/object/string.rb
CHANGED
@@ -25,6 +25,9 @@ class Code
|
|
25
25
|
elsif operator == "reverse"
|
26
26
|
sig(arguments)
|
27
27
|
reverse
|
28
|
+
elsif operator == "include?"
|
29
|
+
sig(arguments) { ::Code::Object::String }
|
30
|
+
include?(value)
|
28
31
|
else
|
29
32
|
super
|
30
33
|
end
|
@@ -83,6 +86,10 @@ class Code
|
|
83
86
|
def reverse
|
84
87
|
::Code::Object::String.new(raw.reverse)
|
85
88
|
end
|
89
|
+
|
90
|
+
def include?(value)
|
91
|
+
::Code::Object::Boolean.new(raw.include?(value.raw))
|
92
|
+
end
|
86
93
|
end
|
87
94
|
end
|
88
95
|
end
|
data/lib/code/ruby.rb
CHANGED
@@ -39,7 +39,7 @@ class Code
|
|
39
39
|
)
|
40
40
|
elsif array?
|
41
41
|
::Code::Object::List.new(
|
42
|
-
raw.map { |element| ::Code::Ruby.to_code(
|
42
|
+
raw.map { |element| ::Code::Ruby.to_code(element) }
|
43
43
|
)
|
44
44
|
elsif proc?
|
45
45
|
::Code::Object::RubyFunction.new(raw)
|
@@ -66,11 +66,11 @@ class Code
|
|
66
66
|
raw
|
67
67
|
.raw
|
68
68
|
.map do |key, value|
|
69
|
-
[::Code::Ruby.
|
69
|
+
[::Code::Ruby.from_code(key), ::Code::Ruby.from_code(value)]
|
70
70
|
end
|
71
71
|
.to_h
|
72
72
|
elsif code_list?
|
73
|
-
raw.raw.map { |element| ::Code::Ruby.
|
73
|
+
raw.raw.map { |element| ::Code::Ruby.from_code(element) }
|
74
74
|
else
|
75
75
|
raise "Unsupported class #{raw.class} for Code to Ruby conversion"
|
76
76
|
end
|
data/lib/template/version.rb
CHANGED
data/spec/code/string_spec.rb
CHANGED
@@ -15,7 +15,8 @@ RSpec.describe "string" do
|
|
15
15
|
["'Hello \\{name}'", "Hello {name}"],
|
16
16
|
['"Hello \\{name}"', "Hello {name}"],
|
17
17
|
["'Hello {1}'", "Hello 1"],
|
18
|
-
['"Hello {1}"', "Hello 1"]
|
18
|
+
['"Hello {1}"', "Hello 1"],
|
19
|
+
['"Hello".include?("H")', "true"]
|
19
20
|
].each do |input, output|
|
20
21
|
context input do
|
21
22
|
let(:input) { input }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: language-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -30,6 +30,7 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
+
- ".cherry.js"
|
33
34
|
- ".editorconfig"
|
34
35
|
- ".github/workflows/rspec.yml"
|
35
36
|
- ".gitignore"
|