ph_model 1.1.2 → 1.1.3

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
  SHA256:
3
- metadata.gz: 22c9a24cf0e12f417a5dfa23f3fb967828e9772533bfde21e1ea8ff4547d8bfe
4
- data.tar.gz: b5ea967101912061b338ed8d80e9bdd06f79848cd3996e7fa51234bd77bec316
3
+ metadata.gz: b21ee085fad1255502d03a29da7c57d01cbea98465169b750643ad41544170fe
4
+ data.tar.gz: b558977aa8e7620fb580b5861f7706b8af7019363debc34c6465b7236f11f750
5
5
  SHA512:
6
- metadata.gz: b33ddd683bbee7054fa38ba0ee5ca8841276d75a3cba2cc3c5915297a9a4a4bcecd9a826339ab23048c8d42a54b26977bc5b6e93765ced081b753b99367c157d
7
- data.tar.gz: e6b149296201228a3d72a4dd6edad1480a4a97b904e3fa35a1782be1d36e1a4ab8f192395fc15794642c21f8aff62912bec6dee7cf9d909271fad5012ec692bd
6
+ metadata.gz: e381cc246de657326afcb31e75b8a6dd7e48f1dfde51b8645b66d9efee197381838c996ffebd89884e57447e496116153fa1679b885488e89784862d65193c9e
7
+ data.tar.gz: 2c86ce6deccccf5e63332c9e3c6387d7195254cc6b8e02a7220d8a7462a53f13c9adae2c9c6dc30baa70e0d1a133d64c96fb98ca65a99c9d14d5b7b4a18449e6
@@ -27,7 +27,8 @@ module PhModel
27
27
  end
28
28
 
29
29
  def check_one(value, attribute_name)
30
- return if !value.respond_to?(:valid?) || !value.respond_to?(:errors) || value.errors.nil? || value.valid?
30
+ return if !value.respond_to?(:valid?) || !value.respond_to?(:errors) || value.errors.nil? ||
31
+ (value.respond_to?(:frozen?) && value.frozen?) || value.valid?
31
32
  value.errors.full_messages.each do |message|
32
33
  errors.add(:base, "#{attribute_name}.#{message}")
33
34
  end
@@ -40,8 +40,8 @@ module PhModel
40
40
  when nil
41
41
  true
42
42
  when Array
43
- if type.count != 1
44
- raise ArgumentError, "don't know how to handle type: #{type.inspect}"
43
+ if type.count > 1
44
+ type.any? { |typ| value.is_a?(typ) }
45
45
  else
46
46
  if value.kind_of? Array
47
47
  value.all? { |item| item.is_a?(type.first) }
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module PhModel
3
- VERSION = '1.1.2'.freeze
3
+ VERSION = '1.1.3'.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.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Banasik
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-22 00:00:00.000000000 Z
11
+ date: 2022-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport