use_context 1.1.0 → 1.1.1

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: f4c30166e7e8f3c7a661205455d9095e632f31a349ed72213b80876730c89ab9
4
- data.tar.gz: 7e38977774ad56f2ab3465088fb800137553b7d97037b126cb548fc64218fb1e
3
+ metadata.gz: 90aac299a67f5dbfbb1e2580c29021dafdd1ba06e0c4e6771a15faa6a673a3dc
4
+ data.tar.gz: 4241b82b90fb4c902bae71dc2609f4651dc2eaf3ccd3cea1bddc54d08fdc1916
5
5
  SHA512:
6
- metadata.gz: 01ec5bb17b6bf570b9114a482180b8b3946f902fae756670d457803fd2b9b067d1cf1999138c97d214e0a46fbdeadc170b0a7acea140f9f2209d84bc6b36fadf
7
- data.tar.gz: 216cfa9b71450937b76c00513f08901cf22c6b5744fde6df9978592fbc530328aa7c0cbeaf92230b03a53a21408ef5a20ae455d16193d5f9c69d1063bbaab94b
6
+ metadata.gz: 7527e2b3c96f0470f4997bd366d3b8071f4a17a07b00d101e2fa6b868fa435a54e991fdd6997594374a989dd16b9dadd8deea1c1806da09749dd16307fd6b053
7
+ data.tar.gz: 9d23e93d4ff8c0c85c7d618fd2d38f2d46617fd048ba2ec39069fb3f0d529c1caba5f8cef50dd7d80eacc3087385096fc548f771d2f6827fb04a062f1042892c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.1.1
2
+ * Fix bug in context extraction that would yield an array instead of a value when only a single key was specified.
3
+
1
4
  # 1.1.0
2
5
  * `use_context` now treats all argments after the context name as context keys to extract and yield to the block:
3
6
  ```ruby
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UseContext
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
data/lib/use_context.rb CHANGED
@@ -87,7 +87,7 @@ module UseContext
87
87
  if keys.empty?
88
88
  yield context
89
89
  else
90
- yield keys.map { |key| context[key] }
90
+ yield(*keys.map { |key| context[key] })
91
91
  end
92
92
  end
93
93
  end
data/test/kernel_test.rb CHANGED
@@ -101,6 +101,14 @@ class KernelTest < Minitest::Test
101
101
  end
102
102
  end
103
103
 
104
+ def test_use_context_can_extract_given_key
105
+ provide_context(:test, { setting1: :a, setting2: :b }) do
106
+ use_context(:test, :setting1) do |setting1|
107
+ assert_equal :a, setting1
108
+ end
109
+ end
110
+ end
111
+
104
112
  def test_use_context_can_extract_given_keys
105
113
  provide_context(:test, { setting1: :a, setting2: :b }) do
106
114
  use_context(:test, :setting1, :setting2) do |setting1, setting2|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: use_context
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro