Skip to content

Commit f4e2402

Browse files
committed
Prep for version 5.1
Appease the cops. Signed-off-by: Josep M. Blanquer <blanquer@gmail.com>
1 parent 24ae0d0 commit f4e2402

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo: false
22
language: ruby
33
rvm:
4-
- 2.2.3
4+
- 2.2.5
55
- 2.3.1
66
script:
77
- bundle exec rspec spec

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## next
44

5+
## 5.1
6+
57
* Added `Polymorphic` type. See [polymorphics.rb](spec/support/polymorphics.rb) for example usage.
68

79
## 5.0.2

lib/attributor/attribute.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
module Attributor
44
class FakeParent < ::BasicObject
5-
def method_missing(name, *_args)
5+
def respond_to_missing?(_method_name)
6+
true
7+
end
8+
9+
def method_missing(name, *_args) # rubocop:disable Style/MethodMissing
610
::Kernel.warn "Warning, you have tried to access the '#{name}' method of the 'parent' argument of a Proc-defined :default values." \
711
"Those Procs should completely ignore the 'parent' attribute for the moment as it will be set to an " \
812
'instance of a useless class (until the framework can provide such functionality)'

lib/attributor/types/hash.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,11 @@ def validate_keys(context)
558558
next if value.validating
559559
end
560560

561-
errors.push(*attribute.validate(value, sub_context))
561+
errors.concat attribute.validate(value, sub_context)
562562
end
563563
self.class.requirements.each do |requirement|
564564
validation_errors = requirement.validate(keys_with_values, context)
565-
errors.push(*validation_errors) unless validation_errors.empty?
565+
errors.concat(validation_errors) unless validation_errors.empty?
566566
end
567567
errors
568568
end
@@ -572,12 +572,12 @@ def validate_generic(context)
572572
# FIXME: the sub contexts and error messages don't really make sense here
573573
unless key_type == Attributor::Object
574574
sub_context = context + ["key(#{key.inspect})"]
575-
errors.push(*key_attribute.validate(key, sub_context))
575+
errors.concat key_attribute.validate(key, sub_context)
576576
end
577577

578578
unless value_type == Attributor::Object
579579
sub_context = context + ["value(#{value.inspect})"]
580-
errors.push(*value_attribute.validate(value, sub_context))
580+
errors.concat value_attribute.validate(value, sub_context)
581581
end
582582
end
583583
end

lib/attributor/types/model.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ def validate(context = Attributor::DEFAULT_ROOT_CONTEXT)
142142
next if value.validating
143143
end
144144

145-
errors.push(*sub_attribute.validate(value, sub_context))
145+
errors.concat sub_attribute.validate(value, sub_context)
146146
end
147147
self.class.requirements.each do |req|
148148
validation_errors = req.validate(keys_with_values, context)
149-
errors.push(*validation_errors) unless validation_errors.empty?
149+
errors.concat(validation_errors) unless validation_errors.empty?
150150
end
151151

152152
errors

lib/attributor/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Attributor
2-
VERSION = '5.0.2'.freeze
2+
VERSION = '5.1.0'.freeze
33
end

0 commit comments

Comments
 (0)