pavlov 0.1.7 → 0.1.7.1

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: 32f5a2414ffc45283f8602bafb5f8715a4e99a26
4
- data.tar.gz: 642831b040f9a90ebe6b8633488a7ffbbb9dc797
3
+ metadata.gz: 9758ce291059ff9041789760c3859314ca2dfd25
4
+ data.tar.gz: 74b504eed67d6d0f91811dfe78c88b1142c6dad0
5
5
  SHA512:
6
- metadata.gz: c2e4a6194b6717b64c7f475ee255d07a8078f1b0643a61e5bc86c7c2934765880c12c6cdee9979b1aca6cc5a8c0754e9d9c64c4322cda1806b1e104c530a74c6
7
- data.tar.gz: b185b09010c0551e84bf1a25c9a8eca765ec4ffeb9fa73c19c97e017068145718610e3698aba31ec3d4b4a7efc5b446fd8083d89f5528e3f9cd484b0844a9254
6
+ metadata.gz: 09587b7f4e809ef8050ce7ebac50bd91d557352382f8a648861ab3c65025d8900871e5258db93ed94a4b0a03e7cb33df3e198257f1372f37408ea63f39908158
7
+ data.tar.gz: 66f927ebc21ce5168f01796d9c4eefa8986a969838d04f24e375726ebd76dbc13bd4ba073f857400875058ad75115f018bc04f95b7b9a75bbcce82d1cf975f2a
@@ -61,7 +61,7 @@ module Pavlov
61
61
  def arguments(*args)
62
62
  # Add generic attribute for each argument
63
63
  args.each do |argument|
64
- attribute argument, Object
64
+ attribute argument, Object, default: nil
65
65
  end
66
66
 
67
67
  # Add attribute for pavlov_options
@@ -36,18 +36,18 @@ module Pavlov
36
36
  end
37
37
 
38
38
  def check_validation
39
- raise Pavlov::ValidationError, 'some arguments were not given' if attributes_without_defaults_missing_values?
40
- raise Pavlov::ValidationError, 'an argument is invalid' unless validate
39
+ raise Pavlov::ValidationError, "Missing arguments: #{missing_arguments.inspect}" if missing_arguments.any?
40
+ validate
41
41
  end
42
42
 
43
- def attributes_without_defaults_missing_values?
44
- attribute_set.find_index do |attribute|
43
+ def missing_arguments
44
+ attribute_set.select do |attribute|
45
45
  !attribute.options.has_key?(:default) && send(attribute.name).nil?
46
46
  end
47
47
  end
48
48
 
49
49
  def validate
50
- true # no-op, users should override this
50
+ # no-op, users should override this
51
51
  end
52
52
 
53
53
  module ClassMethods
@@ -2,5 +2,5 @@ module Pavlov
2
2
  # We're doing this because we might write tests that deal
3
3
  # with other versions of bundler and we are unsure how to
4
4
  # handle this better.
5
- VERSION = '0.1.7'
5
+ VERSION = '0.1.7.1'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pavlov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-08-15 00:00:00.000000000 Z
16
+ date: 2013-08-19 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: virtus