unifig 0.3.0 → 0.3.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: b77565f94f0a6c120bd7e8b2168fcd09186ca66fc0973a73cf0b6c238656eba7
4
- data.tar.gz: e48489beb9e543a1c22e6e8e449124074a1d0eb957acc03f5e795eef81bd8387
3
+ metadata.gz: 3dd53898f75a8cecfe556024e2136c141586f0d772e493a7125b6391b975d41a
4
+ data.tar.gz: 7402d78ae39a6491381c56d595e9f107447285f8392a9667a43b0e8a09cbcc84
5
5
  SHA512:
6
- metadata.gz: fd21aca175ebf8f3ab9254b4028147a6c3f138d0ea1c43fadf7457a8345acf935dc4044679a3fd7f7943c2479062da0f1e70eccb4acaae1b6cd21e0b89f7f08e
7
- data.tar.gz: c2850b58cca17dfac8bc9e0d0dbbf0b875a32613558f5aedd8d5b92d30b465aa8a37babd8911e6d9478c46cf27e7c22d6d11f443c19895c2d471e2cc7ed45831
6
+ metadata.gz: 742c85475b18944582d8143704a898d1494d5844273e25b7bd2ba0dd49b08a55d6eeffaebd769ff210bdb537a64fe3785dd98e2d24524355d29ea86a95625a99
7
+ data.tar.gz: d9ad1ed5b1838d9761195346cb71ab1e68b02bafe8259d4146cf6a3a70dd7bf0e1dfe9ea0d1cc5fbdb2d47312b976af7f0863c3a50c4caac35532f6338fa39c8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [0.3.1][] (2022-07-31)
2
+
3
+ ## Fixed
4
+
5
+ - Frozen strings returned from providers caused an error.
6
+
1
7
  # [0.3.0][] (2022-07-31)
2
8
 
3
9
  ## Changed
@@ -21,6 +27,7 @@
21
27
 
22
28
  Initial release.
23
29
 
30
+ [0.3.1]: https://github.com/AaronLasseigne/unifig/compare/v0.3.0...v0.3.1
24
31
  [0.3.0]: https://github.com/AaronLasseigne/unifig/compare/v0.2.0...v0.3.0
25
32
  [0.2.0]: https://github.com/AaronLasseigne/unifig/compare/v0.1.0...v0.2.0
26
33
  [0.1.0]: https://github.com/AaronLasseigne/unifig/compare/v0.0.0...v0.1.0
data/README.md CHANGED
@@ -18,13 +18,13 @@ If you want to use Unifig outside of a framework listed above you can manually a
18
18
  Add it to your Gemfile:
19
19
 
20
20
  ``` rb
21
- gem 'unifig', '~> 0.3.0'
21
+ gem 'unifig', '~> 0.3.1'
22
22
  ```
23
23
 
24
24
  Or install it manually:
25
25
 
26
26
  ``` sh
27
- $ gem install unifig --version '~> 0.3.0'
27
+ $ gem install unifig --version '~> 0.3.1'
28
28
  ```
29
29
 
30
30
  This project uses [Semantic Versioning][].
data/lib/unifig/init.rb CHANGED
@@ -97,7 +97,7 @@ module Unifig
97
97
  var = Vars[name]
98
98
  next unless var.value.is_a?(String)
99
99
 
100
- var.value.gsub!(/\${[^}]+}/) do |match|
100
+ var.value = var.value.gsub(/\${[^}]+}/) do |match|
101
101
  name = match[2..-2].to_sym
102
102
  Vars[name].value
103
103
  end
data/lib/unifig/var.rb CHANGED
@@ -32,7 +32,9 @@ module Unifig
32
32
 
33
33
  # @private
34
34
  def value=(obj)
35
- @value = blank?(obj) ? nil : obj
35
+ value = blank?(obj) ? nil : obj
36
+ value = value.dup.freeze unless value.frozen?
37
+ @value = value
36
38
  end
37
39
 
38
40
  # The name of the method this variable can be found using.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unifig
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
data/spec/spec_helper.rb CHANGED
@@ -43,7 +43,7 @@ RSpec.configure do |config|
43
43
 
44
44
  def self.retrieve(var_names)
45
45
  var_names.to_h do |var_name|
46
- [var_name, 42]
46
+ [var_name, '42'.freeze]
47
47
  end
48
48
  end
49
49
  end
@@ -60,7 +60,7 @@ RSpec.describe Unifig::Init do
60
60
  it 'returns the values from the providers in order' do
61
61
  load
62
62
 
63
- expect(Unifig.one).to be 42
63
+ expect(Unifig.one).to eql '42'
64
64
  expect(Unifig.two).to be 2
65
65
  end
66
66
  end
@@ -25,6 +25,13 @@ RSpec.describe Unifig::Var do
25
25
 
26
26
  expect(var.value).to be_nil
27
27
  end
28
+
29
+ it 'freezes the value if no frozen' do
30
+ var.value = 'a'
31
+
32
+ expect(var.value).to eql 'a'
33
+ expect(var.value).to be_frozen
34
+ end
28
35
  end
29
36
 
30
37
  describe '#local_value' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unifig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lasseigne