class2 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: 3f3e7cc958f7403b58f19b0694d665ee99c9797f
4
- data.tar.gz: b92c91959b8076615445b117c5fd83d6136d406d
3
+ metadata.gz: 1acb2d18da3e6cfb18689ecedaa0d86802107f6e
4
+ data.tar.gz: fd226407d158ca0fd0646b7cd5a7a853e9ecd7cc
5
5
  SHA512:
6
- metadata.gz: 0609d0e99bb48816a8b76776fbe2ea520d5a501c345541cec97d5c59cf28645aa5e8177720219b1e1363d2d546fd30ffa81b68321a0ceccbcbcb2cdef4a715a2
7
- data.tar.gz: f4d34009b4521d50d2f97b654889028b119ea8a1c81ea0a65f4fed487aa089c2add5a8ac36d58311e0a04db823d1507d5a990dba9e336e9154fec798fdfddd60
6
+ metadata.gz: e5ab09b2e8ff5af58b82a1cd5e65bd8035d3bf6912819a322afaca3a63c28e713869b6b88ed60dc6f39f136ede41ce5acae6f38cc6e0b472afff4f525de82f19
7
+ data.tar.gz: 7f24bcfc92a94d4ad35f7239b1299b7412ec384db2bf86b199e91bd20ee81fc7fdb008733571d4b3996b4ac233daf753d88d2a7fef41e9cbc71518c878c8c71a
data/Changes CHANGED
@@ -1,3 +1,7 @@
1
+ 2017-09-28 v0.2.2
2
+ --------------------
3
+ * Bug fix: check constant existance before creating
4
+
1
5
  2017-09-23 v0.2.1
2
6
  --------------------
3
7
  * Bug fix: to_h values should not always be a Hash
data/lib/class2.rb CHANGED
@@ -62,7 +62,9 @@ class Class2
62
62
  def create_namespace(str)
63
63
  str.split("::").inject(Object) do |parent, child|
64
64
  # empty? to handle "::Namespace"
65
- child.empty? ? parent : parent.const_set(child, Module.new)
65
+ child.empty? ? parent : parent.const_defined?(child) ?
66
+ # With 2.1 we can just say Object.const_defined?(str) but keep this around for now.
67
+ parent.const_get(child) : parent.const_set(child, Module.new)
66
68
  end
67
69
  end
68
70
 
@@ -1,3 +1,3 @@
1
1
  class Class2
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: class2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skye Shaw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-23 00:00:00.000000000 Z
11
+ date: 2017-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport