schemad 1.2.2 → 1.2.3

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
  SHA1:
3
- metadata.gz: 591b51216e927a53f322119b2c11659e905d14fd
4
- data.tar.gz: 8c3d791c8bb7ee3c74c2726a8cfb99c363850b86
3
+ metadata.gz: c365fd42508eefbf5df2f46504c0a12ecdda0a02
4
+ data.tar.gz: 72dc0e423ede9244418d7c1df9a3405d51b2ccfe
5
5
  SHA512:
6
- metadata.gz: f425f6ab0594c9a3a9152f47ab05974c0648d3e6185795423d38fe6737d93b12350364d6af9dd9605d86e52d7991d157a445b876c9fadf76a3a621d53a4e740c
7
- data.tar.gz: b59de05f895f35cae43e727240ab9fe069035258715efea8501eabf1bc9a97edc5bf48f30f4020993b2603cc8963f388c7f333affef38e7eed2124a0ab3b3bc6
6
+ metadata.gz: 8e6b7c4c4557ed40b1ae2236b032ec9e24c6c33741ea979c641bca682ac4c1305eb3596a85151830be4a54ce4ddbb129325c653c162020a9af76e71a6a234af1
7
+ data.tar.gz: 31e85397afe6b80b73ad7f3894ee12402f24c0e3e34ed99da6037f7499fff0ceb2672ce7927c5d07bf967fa92012e61f69737f29953ec05b00dce011544645aa
data/.travis.yml CHANGED
@@ -1,14 +1,17 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0
4
- - 2.1
5
- - 1.9.3
6
- - rbx
7
- - jruby-19mode
8
-
3
+ - 1.9.3
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
7
+ - rbx
8
+ - jruby-19mode
9
9
  matrix:
10
10
  allow_failures:
11
- - rvm: rbx
12
- - rvm: jruby-19mode
13
-
14
- script: bundle exec rake spec
11
+ - rvm: 1.9.3
12
+ - rvm: rbx
13
+ - rvm: jruby-19mode
14
+ script: bundle exec rake spec
15
+ env:
16
+ global:
17
+ secure: oXespZsV0esupERqRSdJe6WMV4pyUtRUxKqgZZ7+lHDiLf0rUfXeJ96atyqHF293C7oApAkyoM6Lf92Vw5wDJJzdghuDMMa+e18ilHHGD0eDUB3MfDCuj6oHdCTxYs5q9L0rGPTkUcx+EVw3PeFe9CDaWHhIkvosfrdzXf9volU=
@@ -3,10 +3,11 @@ require 'schemad/type_handler'
3
3
 
4
4
  module Schemad
5
5
  class Entity
6
- extend Schemad::Extensions
6
+ include Schemad::Extensions
7
7
 
8
8
  def self.inherited(subclass)
9
- subclass.instance_variable_set(:@attributes, inherited_attrs)
9
+ default_attrs = inherited_var(:@attributes, [])
10
+ subclass.instance_variable_set(:@attributes, default_attrs)
10
11
  end
11
12
 
12
13
  def self.attribute(name, args={}, &block)
@@ -45,10 +46,6 @@ module Schemad
45
46
  alias_method :attributes, :to_hash
46
47
 
47
48
  private
48
- def self.inherited_attrs
49
- parent_attrs = self.instance_variable_get(:@attributes)
50
- default_attrs = (parent_attrs ? parent_attrs.dup : [])
51
- end
52
49
 
53
50
  def self.define_parser_for(name, args, &block)
54
51
  define_method "parse_#{name}" do |data|
@@ -11,6 +11,11 @@ module Schemad
11
11
  def base_class_name
12
12
  name.demodulize
13
13
  end
14
+
15
+ def inherited_var(attr_name, default)
16
+ parent_attrs = self.instance_variable_get(attr_name)
17
+ default_attrs = (parent_attrs ? parent_attrs.dup : default)
18
+ end
14
19
  end
15
20
 
16
21
  def base_class_name
@@ -35,5 +40,7 @@ module Schemad
35
40
  def indifferent_hash(hash)
36
41
  ActiveSupport::HashWithIndifferentAccess.new hash
37
42
  end
43
+
44
+
38
45
  end
39
46
  end
@@ -9,8 +9,11 @@ module Schemad
9
9
  InvalidPath = Class.new(Exception)
10
10
 
11
11
  def self.inherited(subclass)
12
- subclass.instance_variable_set(:@normalizers, {})
13
- subclass.instance_variable_set(:@allowed_attributes, [])
12
+ default_normalizers = inherited_var(:@normalizers, {})
13
+ subclass.instance_variable_set(:@normalizers, default_normalizers)
14
+
15
+ default_allowed = inherited_var(:@allowed_attributes, [])
16
+ subclass.instance_variable_set(:@allowed_attributes, default_allowed)
14
17
  end
15
18
 
16
19
  def self.include_fields(*fields)
@@ -1,3 +1,3 @@
1
1
  module Schemad
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schemad
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke van der Hoeven