expand 1.0.5 → 1.0.6

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: 1c749a422399f6bef2c67bd4ab1503cfd5d3ab99a912b2164c6930931d2861ad
4
- data.tar.gz: e5639cd2f02dae004d3e7d60eac7a2a3eeace870eb2022ca778d785d451b5d20
3
+ metadata.gz: 2f6ea4357fdc4411d7c50e3254b7dafc2fa805a5dabdcee9797c371e1a0c3061
4
+ data.tar.gz: cda6a8448977b174723223ad38dd9af7709d2ff6d20f2fb5d6ec5a90dbd8203a
5
5
  SHA512:
6
- metadata.gz: 3fd15dae2380332348db1806ae0ec289ac57a936404df715d2cb0418cbafd009f213df5d958699510b0d4eed668355ffcba681feb8927adb5fa5e24f87dc0700
7
- data.tar.gz: e4197b51d7e9c5c352492c418bae31e385efb17aac68ef0db5d5fe2fbcebe5b9e6397e227d3d0911a81f1fc9044b77412eaf2e3964c1785473bae8f35a00905b
6
+ metadata.gz: 8d2d514212cd0907017e548a3726e2f8a2bab2fbaee0f60c537762ed1592fca4b70167bc39b34b00abd6674d100e9040ab39253aa4aec21a87137318a6f18466
7
+ data.tar.gz: 8b99003304539699643196d8108ec7023fe544a6a271442fe832d0547f9972cfc8e0e67d5a76cbf6f1a4d5e8df4e8b10401c2e18eb0ad3fa513f9902b7599829
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.6
2
+
3
+ - pass the managed namespace to the `namespace` method as an argument
4
+
1
5
  ## 1.0.5
2
6
 
3
7
  - use pattern matching in the `namespace` method
data/README.md CHANGED
@@ -63,6 +63,18 @@ namespace SomeGem::Thing do
63
63
  end
64
64
  ```
65
65
 
66
+ ## Gotchas
67
+
68
+ Unfortunately, due to the scoping of the blocks passed to the main `namespace` or `expand` methods, you are unable to directly reference classes nested in your namespace.
69
+
70
+ You can, however, pass an argument to the block to use as a reference:
71
+
72
+ ```ruby
73
+ namespace SomeGem::Thing do |klass|
74
+ puts klass #=> yields "SomeGem::Thing"
75
+ end
76
+ ```
77
+
66
78
  ## Installation
67
79
 
68
80
  Add this line to your application's Gemfile:
@@ -1,3 +1,3 @@
1
1
  module Expand
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
data/lib/expand.rb CHANGED
@@ -7,7 +7,7 @@ module Expand
7
7
  #
8
8
  class Manager
9
9
  # @see Expand#namespace
10
- def initialize(namespace, **class_or_module, &block)
10
+ def initialize(namespace)
11
11
  @managed = namespace
12
12
  end
13
13
 
@@ -49,7 +49,7 @@ module Expand
49
49
  end
50
50
 
51
51
  def apply(&block)
52
- instance_eval(&block)
52
+ instance_exec(@managed, &block)
53
53
  @managed
54
54
  end
55
55
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expand
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-01 00:00:00.000000000 Z
11
+ date: 2023-01-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Create classes and modules under an existing namespace
14
14
  email: