attributor 5.5 → 5.6

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
- SHA1:
3
- metadata.gz: 30cd524aa1a60bb34487915e2201e20b075f8eaf
4
- data.tar.gz: 4a9776a1a772b00636a46caec55f583aa75d54f4
2
+ SHA256:
3
+ metadata.gz: 95e7a4d30473d5e7e9dbd37f0e028b9b5dd5b17cf0ceb89593f0aed60dab20de
4
+ data.tar.gz: 59cc3458cd723c43733ea6a128fb4032c8aa8c7cd2ac41ea620c31842da35db6
5
5
  SHA512:
6
- metadata.gz: a5a4832825c92b5530352b626ae281c134aa215f167c633a7912b22cee2927fde696d07b92bfd6159b0e88db4dc69b19b38a289181cb523e0c961005608e4f86
7
- data.tar.gz: a44680f8509acf463ac0c4a22a872db8456300745d01b5c4a31a597bd17760d995e5d6ce26120d998f8df5c4c06fe2d11e7e00c35959f6c987860059425af663
6
+ metadata.gz: 10da45417633b8f159db72d33a81101f25bd90cf8282e3a10e80d3cfb92de90639642dcf51d12d8f8ce4237acd1e2e4e562c97173480b1525cb4914f237d8ce4
7
+ data.tar.gz: e5c2ebc2dd2a214ffb4254332e56366bd825f1dbc93499d26476ed73226dc0e698be75918dab0a5d9853550ba8c88c83ba02afeeae22885254f828d2ac52040e
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## next
4
4
 
5
+ ## 5.6 (11/02/2020)
6
+
7
+ - Small fixes for dumping JSON-schema default values if they're Proc's or dumpable objects
8
+
5
9
  ## 5.5 (21/08/2020)
6
10
 
7
11
  - JSON-schema support. Enhanced all of the types to suppport describing themselves as JSON-schema format (`.as_json_schema`). This description includes a few `x-*` extensions to capture some information that Attributor supports, that JSON-schema does not.
@@ -161,7 +161,10 @@ module Attributor
161
161
 
162
162
  description[:description] = self.options[:description] if self.options[:description]
163
163
  description[:enum] = self.options[:values] if self.options[:values]
164
- description[:default] = self.options[:default] if self.options[:default]
164
+ if the_default = self.options[:default]
165
+ the_object = the_default.is_a?(Proc) ? the_default.call : the_default
166
+ description[:default] = the_object.is_a?(Attributor::Dumpable) ? the_object.dump : the_object
167
+ end
165
168
  #TODO description[:title] = "TODO: do we want to use a title??..."
166
169
 
167
170
  # Change the reference option to the actual class name.
@@ -125,7 +125,10 @@ module Attributor
125
125
  hash = super
126
126
  opts = self.options.merge( attribute_options )
127
127
  hash[:description] = opts[:description] if opts[:description]
128
- hash[:default] = opts[:default] if opts[:default]
128
+ if the_default = opts[:default]
129
+ the_object = the_default.is_a?(Proc) ? the_default.call : the_default
130
+ hash[:description] = the_object.is_a?(Attributor::Dumpable) ? the_object.dump : the_object
131
+ end
129
132
 
130
133
  #hash[:examples] = [ example.dump ] if example
131
134
  member_example = example && example.first
@@ -1,3 +1,3 @@
1
1
  module Attributor
2
- VERSION = '5.5'.freeze
2
+ VERSION = '5.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attributor
3
3
  version: !ruby/object:Gem::Version
4
- version: '5.5'
4
+ version: '5.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep M. Blanquer
8
8
  - Dane Jensen
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-08-21 00:00:00.000000000 Z
12
+ date: 2020-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie
@@ -291,7 +291,7 @@ dependencies:
291
291
  - - ">="
292
292
  - !ruby/object:Gem::Version
293
293
  version: '0'
294
- description:
294
+ description:
295
295
  email:
296
296
  - blanquer@gmail.com
297
297
  - dane.jensen@gmail.com
@@ -392,7 +392,7 @@ homepage: https://github.com/rightscale/attributor
392
392
  licenses:
393
393
  - MIT
394
394
  metadata: {}
395
- post_install_message:
395
+ post_install_message:
396
396
  rdoc_options: []
397
397
  require_paths:
398
398
  - lib
@@ -407,9 +407,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
407
407
  - !ruby/object:Gem::Version
408
408
  version: '0'
409
409
  requirements: []
410
- rubyforge_project:
411
- rubygems_version: 2.6.14
412
- signing_key:
410
+ rubygems_version: 3.0.3
411
+ signing_key:
413
412
  specification_version: 4
414
413
  summary: A powerful attribute and type management library for Ruby
415
414
  test_files: