synvert-core 2.1.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +0 -2
- data/lib/synvert/core/rewriter.rb +0 -16
- data/lib/synvert/core/version.rb +1 -1
- data/spec/synvert/core/rewriter_spec.rb +4 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30e6a2e5daa58d21f2e9ba53e8cb6a16d690d7bceaae3157ee55bf4ab2539208
|
4
|
+
data.tar.gz: 1beb0959459e26b77296bf9bec157b8c4b996d24eb61bb3f0fb1ec068fab74ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbc0e5c4250c91deb0767b11343a57089b34debbcbd02d5dfa0739352ab219fafa361e51754c9ff7f41df4a73a9275fa5334ddf7a9abeba513f4be66b1afcdec
|
7
|
+
data.tar.gz: 1f1a822643f728760ba97af47b0f1a6e436810d6e316037c1c8d38fdd8bd1e012eb2bfffedeae1b6dc6dc23b225240a585c3562b62eea2ef074af9d9a3a99f35
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -78,8 +78,6 @@ DSLs are as follows
|
|
78
78
|
* [add_snippet](https://synvert-hq.github.io/synvert-core-ruby/Synvert/Core/Rewriter.html#add_snippet-instance_method) - call another rewriter
|
79
79
|
* [call_helper](https://synvert-hq.github.io/synvert-core-ruby/Synvert/Core/Rewriter.html#call_helper-instance_method) - call a shared rewriter
|
80
80
|
* [with_configurations](https://synvert-hq.github.io/synvert-core-ruby/Synvert/Core/Rewriter.html#with_configurations-instance_method) - execute a block of code with temporary configurations
|
81
|
-
* [save_data](https://synvert-hq.github.io/synvert-core-ruby/Synvert/Core/Rewriter.html#save_data-instance_method) - save data
|
82
|
-
* [load_data](https://synvert-hq.github.io/synvert-core-ruby/Synvert/Core/Rewriter.html#load_data-instance_method) - load data
|
83
81
|
|
84
82
|
Scopes:
|
85
83
|
|
@@ -416,22 +416,6 @@ module Synvert::Core
|
|
416
416
|
Configuration.with_temporary_configurations(configurations, &block)
|
417
417
|
end
|
418
418
|
|
419
|
-
# Saves data with a given key and value.
|
420
|
-
#
|
421
|
-
# @param key [Symbol] the key to identify the data
|
422
|
-
# @param value [Object] the value to be saved
|
423
|
-
def save_data(key, value)
|
424
|
-
Synvert::Core.instance_variable_set("@#{key}", value)
|
425
|
-
end
|
426
|
-
|
427
|
-
# Loads data with the given key.
|
428
|
-
#
|
429
|
-
# @param key [Symbol] the key of the data to be loaded
|
430
|
-
# @return [Object] the data loaded
|
431
|
-
def load_data(key)
|
432
|
-
Synvert::Core.instance_variable_get("@#{key}")
|
433
|
-
end
|
434
|
-
|
435
419
|
private
|
436
420
|
|
437
421
|
# Handle one file.
|
data/lib/synvert/core/version.rb
CHANGED
@@ -346,11 +346,10 @@ module Synvert::Core
|
|
346
346
|
it 'eval helper by name' do
|
347
347
|
block_receiver = nil
|
348
348
|
block_options = {}
|
349
|
-
helper
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
end
|
349
|
+
Synvert::Helper.new 'helper' do |options|
|
350
|
+
block_receiver = self.class.name
|
351
|
+
block_options = options
|
352
|
+
end
|
354
353
|
rewriter =
|
355
354
|
Rewriter.new 'group', 'rewriter' do
|
356
355
|
call_helper('helper', foo: 'bar')
|
@@ -395,18 +394,6 @@ module Synvert::Core
|
|
395
394
|
expect(instance.dynamic_helper('arg1', 'arg2')).to eq 'dynamic result'
|
396
395
|
end
|
397
396
|
|
398
|
-
it 'parses save_data and load_data' do
|
399
|
-
data = nil
|
400
|
-
rewriter =
|
401
|
-
Rewriter.new 'group', 'name' do
|
402
|
-
hash = { foo: 'bar' }
|
403
|
-
save_data :object, hash
|
404
|
-
data = load_data :object
|
405
|
-
end
|
406
|
-
rewriter.process
|
407
|
-
expect(data).to eq({ foo: 'bar' })
|
408
|
-
end
|
409
|
-
|
410
397
|
describe 'class methods' do
|
411
398
|
before :each do
|
412
399
|
Rewriter.clear
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synvert-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|