ph_model 1.0.2 → 1.1.0

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: 18eb5a8b10e9378536d448b174f91f656023547c
4
- data.tar.gz: 98833d553696e61f645270860eab78de9e46a9a8
3
+ metadata.gz: 45d4629bdc212f29675b3b25d5c86fb28688af9a
4
+ data.tar.gz: 9cf7cbc3e9903b1c84ea2bc0b4de7e68edb71647
5
5
  SHA512:
6
- metadata.gz: 4def997bc8690a1a6273a3fe9006013996980c098bad2a4031fdfc2b3ebeab40eb1ba4a904ef4280afaa177671050bf4d414fc4025ae412b267d48372f1ea440
7
- data.tar.gz: 8b99a104a0715cccba40ad6b1f837d828c72dba5b40e87dbc1f71d3cfb4a0f3a191b83caa8af2a2ac3c0fbdf2ea05e445002f82f07fc546ea3c69c4839487171
6
+ metadata.gz: 5301189e640e50e16f1910f8d8b824b45439c6c221c6f4a0d9358cf18b1f744db8c1d4ae9ccb0a1a29142e49a2b70383bcfbf1f9be5a353d91aae481d38b7a0e
7
+ data.tar.gz: c3e8f29ce56c2663900ec45d9a0ffae810b41df4d53b174796d1eb847e5b07898931b591ba06ccfaa38a66588e6e9f1eae9982acbd8f07888c45883bf705d3a8
@@ -1,5 +1,11 @@
1
1
  module PhModel
2
2
  module Concerns
3
+
4
+ # This will validate any attribute defined with `type: `
5
+ # the type value should be a class, or the special notation `[SomeClass]` which is meant to designate that this is
6
+ # a collection of those classes
7
+ #
8
+ # `no_type_check: true` can be optionally passed to disable this check (other features might use the `type` column)
3
9
  module AttributeTypeValidation
4
10
  extend ActiveSupport::Concern
5
11
 
@@ -9,7 +15,7 @@ module PhModel
9
15
 
10
16
  def ensure_typed_attributes_class
11
17
  self.class.attributes.each do |attribute_name, info|
12
- if info[:type] && !type_match?(attribute_name)
18
+ if info[:type] && !info[:no_type_check] && !type_match?(attribute_name)
13
19
  errors.add(attribute_name, "must be #{info[:type].inspect}, was #{type_summary(attribute_name)}")
14
20
  end
15
21
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module PhModel
3
- VERSION = '1.0.2'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ph_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Banasik
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-06 00:00:00.000000000 Z
11
+ date: 2017-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport