jimmy 0.4 → 0.4.1

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: ddc6e41bad079898badd2db43c168e650d3d4ed4
4
- data.tar.gz: 975617db15ca39512a77c3fa487bb8a74f03a3ad
3
+ metadata.gz: d9a33ee9ed0b7f72d8f48754308e5d9bd61f33a4
4
+ data.tar.gz: f3c83b5489a5b51131f416ded556ccf89c88cded
5
5
  SHA512:
6
- metadata.gz: 2dbfcc870649a7542469dc6ea78101c0c7b248cfbcf64e3c2b9cba0f30f6603b318c4b04fb2b9f7123d606f6c74534da59d22693d2cbd16344e654edd6e2f405
7
- data.tar.gz: 1b0eda56642af23afb2965e0d70f4dc170d708a0b00b03d73db0bead8eb9c7ed95a92b470e87105ced85ae8d89ad06fb3aad61cdea954385721c7de10f391b91
6
+ metadata.gz: 3158fb0245caadaa29bc765927db8ee8f6c4a1bf4663637777657b099a3b924be08ea925c02cda4ecc8ee28ab9bd0771cecf6d68f3d6689741afba0a81450c8a
7
+ data.tar.gz: f5466c57c1e8482a4760931586b1ded7efc499ade5499b3ba0e9c5c73304cfdac45f875f13a34598c47d9e2abf4bbbc6e65b86a5594259f6a90b182a38e5f351
@@ -14,6 +14,10 @@ module Jimmy
14
14
  ipv6
15
15
  uri
16
16
  ].each { |k| trait(k) { format k } }
17
+ trait(:enum) do |*values|
18
+ attrs[:enum] ||= []
19
+ attrs[:enum] |= values.flatten.map(&:to_s)
20
+ end
17
21
  trait(Regexp) { |regex| pattern regex }
18
22
  trait Range do |value|
19
23
  variation = value.exclude_end? ? 1 : 0
@@ -26,7 +30,7 @@ module Jimmy
26
30
  end
27
31
  end
28
32
  trait(Fixnum) { |value| min_length value; max_length value }
29
- trait(Array) { |value| attrs[:enum] = value.map(&:to_s) }
33
+ trait(Array) { |value| enum value }
30
34
 
31
35
  compile do |hash|
32
36
  hash.merge! camelize_attrs(%i[min_length max_length pattern enum format])
data/lib/jimmy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jimmy
2
- VERSION = '0.4'
2
+ VERSION = '0.4.1'
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
+ version: 0.4.1
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-18 00:00:00.000000000 Z
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema