class_kit 0.2.4 → 0.2.5

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: dc76efa8bece6ce97ebdd183cf8dfbb714eab01e
4
- data.tar.gz: ecd76a46a52174f00a5063efe331270a3351a799
3
+ metadata.gz: b04e63defcbf713db13b397030088c75df322988
4
+ data.tar.gz: 7c6ff0680abd2ac61303817e3f1e4cb4b6e2faac
5
5
  SHA512:
6
- metadata.gz: a64b6be2224ce8daa5ffafd09b3a896ce19186d05045c43874ea1d4fa4f3530953b180750c7bf52d795b32ce81e87cfb1182ad01520d3884f0d97cbffe235549
7
- data.tar.gz: b9f06655edf946da687ebac8febd2f10f693e30e80134d01b1f141e2d04db67feaf300febca1958acd3bb39c3a115211e1f5564e8fb89abeed0ff26540d7f405
6
+ metadata.gz: 2865ee3791b6aa2aeb21634dee06d664c8e723903592ab01f223a4778eb4ebd58de605c61182548d2eed07d7a886356cbabaa221881c175ab7a17d7ebbe7dcff
7
+ data.tar.gz: 22da5d28f81a7ae473c83e4f8b942c7fc92a7c2e40a37cadd8d4a1462f17ad4c25219a9c9a7a7253d3ae74d35bd26c4c150bfd3e3d304b7a6bc02aaddb35002d
@@ -1,5 +1,10 @@
1
1
  module ClassKit
2
2
  class AttributeHelper
3
+
4
+ def self.instance
5
+ @instance ||= ClassKit::AttributeHelper.new
6
+ end
7
+
3
8
  # Get attributes for a given class
4
9
  #
5
10
  # @param klass [ClassKit] a class that has been extended with ClassKit
@@ -10,8 +10,6 @@ module ClassKit
10
10
 
11
11
  attributes[name] = { name: name, type: type, collection_type: collection_type, allow_nil: allow_nil,
12
12
  default: default, auto_init: auto_init, meta: meta }
13
- puts self
14
- puts self.ancestors
15
13
 
16
14
  class_eval do
17
15
  define_method name do
@@ -34,7 +32,7 @@ module ClassKit
34
32
  class_eval do
35
33
  define_method "#{name}=" do |value|
36
34
  #get the attribute meta data
37
- cka = self.class.instance_variable_get(:@class_kit_attributes)[name]
35
+ cka = ClassKit::AttributeHelper.instance.get_attribute(klass: self.class, name: name)
38
36
 
39
37
  #verify if the attribute is allowed to be set to nil
40
38
  if value.nil? && cka[:allow_nil] == false
@@ -1,3 +1,3 @@
1
1
  module ClassKit
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: class_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-28 00:00:00.000000000 Z
11
+ date: 2016-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler