jimmy 0.4.4 → 0.4.5

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
  SHA1:
3
- metadata.gz: fd49ef4d4b05d882f3725e1a218a36d3b284a700
4
- data.tar.gz: 106425471819a818f6d7f02f015a75c6f80b9284
3
+ metadata.gz: f652069943cf8ded7610304ef3053d0260c3fdf8
4
+ data.tar.gz: fa7c2a51e59cf67867ece774924d5bb0b7a81553
5
5
  SHA512:
6
- metadata.gz: 038ae82ea61923a19dfe426c495ebc31f63cc3e99e3e3f6f10321800cc2d50c55eead86712502ac1b77f8919e33732df61adb32a0c4da009d91a86d32af376b9
7
- data.tar.gz: 778c1788969d57776069c776a2947b9689fb9fd09767f013e4bb647f379ff50b51a0968923552f6486c2cee626a86efcd691175f9c6b605950035a151f4d88fc
6
+ metadata.gz: a8565852915935b93e0b184457e54b4f50257fb9dab2e615ad0a8ec582497bf3332a9df977b46dedca74c050c84bb4d2950a3d10b8314428d59eccbf7f7a9c7a
7
+ data.tar.gz: 7b95a43c73126cb6cf7a749b566f56108b7487931b74e7674e3629ac2ceef954c050ec3126262b843cc579b67a66909fb07706d5c6bd3aa55053bd55a865ca0e
@@ -58,12 +58,12 @@ module Jimmy
58
58
  @schemas[schema_name.to_s]
59
59
  end
60
60
 
61
- def export(path = nil)
61
+ def export(path = nil, &serializer)
62
62
  path = Pathname(path) if path.is_a? String
63
63
  raise 'Please specify an export directory' unless path.is_a?(Pathname) && (path.directory? || !path.exist?)
64
64
  path.mkpath
65
- @schemas.each { |name, schema| export_schema schema, path + "#{name.to_s}.json" }
66
- @types.each { |name, schema| export_schema schema, path + 'types' + "#{name.to_s}.json" }
65
+ @schemas.each { |name, schema| export_schema schema, path + "#{name.to_s}.json", &serializer }
66
+ @types.each { |name, schema| export_schema schema, path + 'types' + "#{name.to_s}.json", &serializer }
67
67
  end
68
68
 
69
69
  def uri_for(name)
@@ -98,7 +98,7 @@ module Jimmy
98
98
 
99
99
  def export_schema(schema, target_path)
100
100
  target_path.parent.mkpath
101
- target_path.write JSON.pretty_generate(schema.to_h)
101
+ target_path.write block_given? ? yield(schema.to_h) : JSON.pretty_generate(schema.to_h)
102
102
  end
103
103
 
104
104
  SchemaCreation.apply_to self
@@ -1,3 +1,3 @@
1
1
  module Jimmy
2
- VERSION = '0.4.4'
2
+ VERSION = '0.4.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jimmy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil E. Pearson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-31 00:00:00.000000000 Z
11
+ date: 2015-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema