template-ruby 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22324991b6fb7e6440917eef572f8983c60038e83812ee04315f92ea1da17bc8
4
- data.tar.gz: 9b0a7f5d97a9a076b711e7bf8872722d46a2906f98e988f9b661a150a5dcec00
3
+ metadata.gz: 4c93dab32eff0c5a9fdc1c94e066b1273000a45eccc03be2688d8ad0bf851801
4
+ data.tar.gz: 3ecc5e55616b4c4cf3076dea738843b15f44ca0bbc4bfdc99b590abe34262d3e
5
5
  SHA512:
6
- metadata.gz: 92248c14d47399ff98720083182d4933a064679a8d5a218256aa6097c307ffbfcaf7f7a5830624210306978aa7ccbe2301dc94f606b2ad05c65e618e966ca2f4
7
- data.tar.gz: 36e9c2247fa179763e091499d2c4315e45bb302308e7460ac4b9fca3513bfad0ae7bfe4fbf95ea2071295b3d892874bc5b26248a2f19762c3a3d6e66a0f48812
6
+ metadata.gz: 7eb65d035c30c7682776058f2d9fc23539eb56918fa542764ceb028d06bf1aaf78912dcc7c0ba9c96a83f728f1f28430525df08ae23544e3caff0f3625f6bfab
7
+ data.tar.gz: e4ffa29394a688024ba94e6c27de9256cffcf86e5e7a21898d6658e634b85061e84f709be09363a06b4b0fccb9fc02e33e6540289b07a622de30da81c20a2bb1
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 ADDED
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ rm *.gem
6
+ git pull
7
+ git push
8
+
9
+ for file in *.gemspec
10
+ do
11
+ gem build $file
12
+ done
13
+
14
+ for file in *.gem
15
+ do
16
+ gem push $file
17
+ done
18
+
19
+ rm *.gem
@@ -3,9 +3,8 @@ require_relative "lib/template/version"
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "language-ruby"
5
5
  s.version = ::Template::Version
6
- s.summary = "A Parsing Expression Grammar (PEG)"
7
- s.description =
8
- 'A Parsing Expression Grammar (PEG) for making parsers'
6
+ s.summary = "A Parsing Expression Grammar (PEG) for making parsers"
7
+ s.description = s.summary
9
8
  s.authors = ["Dorian Marié"]
10
9
  s.email = "dorian@dorianmarie.fr"
11
10
  s.files = `git ls-files`.split($/)
@@ -55,6 +55,9 @@ class Code
55
55
  elsif operator == "<<"
56
56
  sig(arguments) { ::Code::Object }
57
57
  append(value)
58
+ elsif operator == "include?"
59
+ sig(arguments) { ::Code::Object }
60
+ include?(value)
58
61
  else
59
62
  super
60
63
  end
@@ -180,6 +183,10 @@ class Code
180
183
  self
181
184
  end
182
185
 
186
+ def include?(other)
187
+ ::Code::Object::Boolean.new(raw.include?(other))
188
+ end
189
+
183
190
  def first
184
191
  raw.first || ::Code::Object::Nothing.new
185
192
  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(key) }
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.to_code(key), ::Code::Ruby.to_code(value)]
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.to_code(element) }
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/language/atom.rb CHANGED
@@ -194,7 +194,6 @@ class Language
194
194
  clone =
195
195
  Parser.new(root: self, input: parser.input, cursor: parser.cursor)
196
196
 
197
- require "colorize"
198
197
  @parent.parse(clone)
199
198
 
200
199
  if clone.output?
@@ -1,3 +1,3 @@
1
1
  require_relative "../template"
2
2
 
3
- Template::Version = Gem::Version.new("0.5.0")
3
+ Template::Version = Gem::Version.new("0.5.2")
@@ -7,6 +7,8 @@ RSpec.describe "list" do
7
7
  [
8
8
  ["[]", "[]"],
9
9
  ["[1, 2, 3]", "[1, 2, 3]"],
10
+ ["[1, 2, 3].include?(2)", "true"],
11
+ ["[1, 2, 3].include?(4)", "false"],
10
12
  ["[[true]]", "[[true]]"]
11
13
  ].each do |input, output|
12
14
  context input do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: template-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.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: 2022-11-28 00:00:00.000000000 Z
11
+ date: 2023-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -32,6 +32,7 @@ executables:
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
+ - ".cherry.js"
35
36
  - ".editorconfig"
36
37
  - ".github/workflows/rspec.yml"
37
38
  - ".gitignore"
@@ -45,6 +46,7 @@ files:
45
46
  - TODO
46
47
  - bin/code
47
48
  - bin/format
49
+ - bin/publish
48
50
  - bin/template
49
51
  - bin/test
50
52
  - code-ruby.gemspec
@@ -236,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
238
  - !ruby/object:Gem::Version
237
239
  version: '0'
238
240
  requirements: []
239
- rubygems_version: 3.3.7
241
+ rubygems_version: 3.3.26
240
242
  signing_key:
241
243
  specification_version: 4
242
244
  summary: A templating programming language