fried-schema 1.0.0 → 1.1.0

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: 23815d2c6643330c7882829e738c0443011ba57a
4
- data.tar.gz: 758119e620df5f4a1b7f788a68332fc093142ed0
3
+ metadata.gz: a615c7ea19d0244ce08a18d86d25440eaf83e189
4
+ data.tar.gz: 371e26fae5f1dcd7a5b4643174a95fe3e3059013
5
5
  SHA512:
6
- metadata.gz: 717d5115e4e819e470e8643b3d6948cd2721bb3cb27f8225a687315bae9af01af66244a6e4778ebd0ccc48fca2ada09ed201fce8e9ae9745635771e9cc40b30c
7
- data.tar.gz: 378fc6154e2968f271405a843aa3f9aefdb285033c01c66d011a712364a969a6a5aa9dc716ee61f98461532051c2ddc89e353d4ebd7ddb56652e511189037e69
6
+ metadata.gz: e1e686ac6471cd4b1017c3854aa90dfd614b08e61b20e2e8b81d4fc7b09ffdf26d4b911da6c4853f6ead0a16f742ec8965fd3deb7136a603db6e6b337dafa172
7
+ data.tar.gz: a28e79ee31e986c34e427552766382828f028042e52d543a2557d290f2431c2d1f2be7e33ab995841265eb6366156d9b75eeae79a0deb212fe88d21e0823f552
data/README.md CHANGED
@@ -71,6 +71,36 @@ person.age # => 123
71
71
  person.to_h # => { name: "John", born_at: 2017-11-24 00:55:50 -0800, age: 123 }
72
72
  ```
73
73
 
74
+ ### Fried::Typings integration
75
+
76
+ The gem integrates with [fried-typings][fried-typings-link], you can use
77
+ those type as checks:
78
+
79
+ ```ruby
80
+ class Person
81
+ include Fried::Typings
82
+ include Fried::Schema::DataEntity
83
+
84
+ attribute :hobbies, ArrayOf[String], default: []
85
+ attribute :something, OneOf[String, Numeric]
86
+ end
87
+
88
+ person = Person.build(hobbies: ["foo", "bar"])
89
+
90
+ person.hobbies # => ["foo", "bar"]
91
+ person.hobbies = [123, "foo"] # => raises TypeError
92
+ person.hobbies = []
93
+ person.hobbies # => []
94
+ person.hobbies = ["test"]
95
+ person.hobbies # => ["test"]
96
+
97
+ person.something = "foo"
98
+ person.something # => "foo"
99
+ person.something = 123
100
+ person.something # => 123
101
+ person.something = nil # => raises TypeError
102
+ ```
103
+
74
104
  ## Development
75
105
 
76
106
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -83,3 +113,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Fire-D
83
113
 
84
114
  [test-badge]: https://travis-ci.org/Fire-Dragon-DoL/fried-schema.svg?branch=master
85
115
  [test-link]: https://travis-ci.org/Fire-Dragon-DoL/fried-schema
116
+ [fried-typings-link]: https://github.com/Fire-Dragon-DoL/fried-typings
@@ -1,5 +1,5 @@
1
1
  module Fried
2
2
  module Schema
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fried-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fire-Dragon-DoL