expand 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/lib/expand.rb +6 -4
- data/lib/expand/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67a04674a13b0dbfca22f2452f5f206af05452bb
|
4
|
+
data.tar.gz: 7ea40c2d4bae7463a3ad99420107e96a5fc4d2e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8df7158a2bdaf8375cc5d8b7f782ae367fc081efcdd17e21352d252d20f3d1dfe33b3718046f693b58567fa58949514905373e70e850cfd3bcb8767478512c92
|
7
|
+
data.tar.gz: 8c8f197f5ce23a87e9db11382be77e3f97b0ce50f07f7013c4390d72d335f6020727993f9bbf107f6e7f86dfc632b51a1dcd4bc4ec83a75bba58123251310d89
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Expand
|
2
2
|
|
3
3
|
Use Expand to create classes or modules under an existing namespace.
|
4
4
|
|
@@ -25,7 +25,7 @@ To make this simpler, you can require `expand` and extend your current context w
|
|
25
25
|
reuire 'expand'
|
26
26
|
extend Expand
|
27
27
|
|
28
|
-
namespace
|
28
|
+
namespace SomeGem::Thing do
|
29
29
|
create_class :NewThing do
|
30
30
|
# define methods here
|
31
31
|
end
|
data/lib/expand.rb
CHANGED
@@ -19,11 +19,13 @@ module Expand
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def namespace(
|
23
|
-
|
24
|
-
|
22
|
+
def namespace(context, &block)
|
23
|
+
unless context.is_a?(Module)
|
24
|
+
context = context.to_s.split('::').inject(Object) do |base, mod|
|
25
|
+
base.const_get(mod)
|
26
|
+
end
|
25
27
|
end
|
26
|
-
Manager.new(
|
28
|
+
Manager.new(context).instance_eval(&block)
|
27
29
|
end
|
28
30
|
alias expand namespace
|
29
31
|
end
|
data/lib/expand/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "'Jim Gay'"
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
63
|
- ".travis.yml"
|
64
|
+
- CHANGELOG.md
|
64
65
|
- CODE_OF_CONDUCT.md
|
65
66
|
- Gemfile
|
66
67
|
- LICENSE.txt
|