sinclair 1.12.0 → 1.12.1

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: 1a194ca690bacbcb4a928dc5295a60f6e574b6cf567cc81ab33a293dbe9d3643
4
- data.tar.gz: 77d34d971fee05045d57e73939a0a299707cad027bb770c09e348ca35fb76bce
3
+ metadata.gz: b14d0d24d28075129d870b9f2b93c306e894407a70878d7950e0c73e7f747dbb
4
+ data.tar.gz: 5a3d836d3b8eb5dc299dd17836e50f387fe3273820e91ef95581aac25348407d
5
5
  SHA512:
6
- metadata.gz: aa8cc30f12639711e53e3e2396fa59075ea59673fb49469be8ad757f8502b75ed07df9b57a0a4c863dd0067b1cd655455bdf649189318d04a71f8c758af7c7d5
7
- data.tar.gz: 29942c828c7621d728307f16731fbc5ac715371512e35a8872d9f6102b07c54256a4571e0324cc82e69703d7b75a6ce87b2658ff26ef54886b69bc0d15a3f6ec
6
+ metadata.gz: c6bbf090685049aaa1936e632ed420060ccead6071bb9864de3b5e26f16ad68431b6d01de24442f4ac4ce87792158a5def414680fe9d6b941d4031b766bd386e
7
+ data.tar.gz: ef28a8f5b9f5b9e9e12cd36c558fe2bb14fededbea91df46cda1b2d8570d0fec22809dc3e36f4af61844da370ea659463df03562232883121d0ebc7f40a63e81
data/README.md CHANGED
@@ -13,13 +13,13 @@ This gem helps the creation of complex gems/concerns
13
13
  that enables creation of methods on the fly through class
14
14
  methods
15
15
 
16
- Current Release: [1.12.0](https://github.com/darthjee/sinclair/tree/1.12.0)
16
+ Current Release: [1.12.1](https://github.com/darthjee/sinclair/tree/1.12.1)
17
17
 
18
- [Next release](https://github.com/darthjee/sinclair/compare/1.12.0...master)
18
+ [Next release](https://github.com/darthjee/sinclair/compare/1.12.1...master)
19
19
 
20
20
  Yard Documentation
21
21
  -------------------
22
- [https://www.rubydoc.info/gems/sinclair/1.12.0](https://www.rubydoc.info/gems/sinclair/1.12.0)
22
+ [https://www.rubydoc.info/gems/sinclair/1.12.1](https://www.rubydoc.info/gems/sinclair/1.12.1)
23
23
 
24
24
  Installation
25
25
  ---------------
@@ -6,5 +6,4 @@ ignore:
6
6
  - lib/sinclair/matchers/base.rb
7
7
  - lib/sinclair/matchers/change_method_on.rb
8
8
  - lib/sinclair/matchers/method_to.rb
9
- - lib/sinclair/method_definition/parameter_helper.rb
10
9
  - lib/sinclair/version.rb
@@ -116,7 +116,7 @@ class Sinclair
116
116
  def defaults_strings
117
117
  joinner = named? ? ': ' : ' = '
118
118
  defaults.map do |key, value|
119
- "#{key}#{joinner}#{value}"
119
+ "#{key}#{joinner}#{value.to_json}"
120
120
  end
121
121
  end
122
122
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Sinclair
4
- VERSION = '1.12.0'
4
+ VERSION = '1.12.1'
5
5
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Sinclair::MethodDefinition::ParameterHelper do
6
+ describe '.parameters_from' do
7
+ context 'when parameters are not named' do
8
+ context 'when there are no defaults' do
9
+ it 'returns a list of parameters' do
10
+ expect(described_class.parameters_from(%i[a b]))
11
+ .to eq(%w[a b])
12
+ end
13
+ end
14
+
15
+ context 'when there are defaults' do
16
+ let(:parameters) do
17
+ [{ a: 10, b: 'word', c: true, d: false }]
18
+ end
19
+
20
+ it 'returns a list of parameters' do
21
+ expect(described_class.parameters_from(parameters))
22
+ .to eq(['a = 10', 'b = "word"', 'c = true', 'd = false'])
23
+ end
24
+ end
25
+ end
26
+
27
+ context 'when parameters are named' do
28
+ context 'when there are no defaults' do
29
+ it 'returns a list of parameters' do
30
+ expect(described_class.parameters_from(%i[a b], named: true))
31
+ .to eq(%w[a: b:])
32
+ end
33
+ end
34
+
35
+ context 'when there are defaults' do
36
+ let(:parameters) do
37
+ [{ a: 10, b: 'word', c: true, d: false }]
38
+ end
39
+
40
+ it 'returns a list of parameters' do
41
+ expect(described_class.parameters_from(parameters, named: true))
42
+ .to eq(['a: 10', 'b: "word"', 'c: true', 'd: false'])
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinclair
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DarthJee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-14 00:00:00.000000000 Z
11
+ date: 2023-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -380,6 +380,7 @@ files:
380
380
  - spec/lib/sinclair/method_definition/block_helper_spec.rb
381
381
  - spec/lib/sinclair/method_definition/call_definition_spec.rb
382
382
  - spec/lib/sinclair/method_definition/parameter_builder_spec.rb
383
+ - spec/lib/sinclair/method_definition/parameter_helper_spec.rb
383
384
  - spec/lib/sinclair/method_definition/string_definition_spec.rb
384
385
  - spec/lib/sinclair/method_definition_spec.rb
385
386
  - spec/lib/sinclair/method_definitions_spec.rb