camille 0.6.4 → 1.0.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
  SHA256:
3
- metadata.gz: 8d5bb9ed1aaea6f00edbd04bf5d20a37d1a6f3cac39afc9a589e8e458f4c5363
4
- data.tar.gz: c3e50816796af03af2b1be68cfaf635bb0ee6cc692451caadf927cc0f0f53b56
3
+ metadata.gz: a1ea493a56729858449f5d04a2242a0920a1aff7e345fde52d7fed3061b9cb3e
4
+ data.tar.gz: 624ef2a41e1c413e8e288de97f6b464f02ce51d9f2cda9eeed9b7ba4a818aaad
5
5
  SHA512:
6
- metadata.gz: d109a1064725e968ad7c89a5b0814ecb3e2f3ba58004c680d26548baaea3a0306e992511e51bc73a7856202a60749c50de342d56902cee722872f6803625f83e
7
- data.tar.gz: 60bfc88c5b15e31ce42dbcff1f86cfe673c14c5510a5813b1900cdf76aa8cc58d590fdb85a618dd3ddcc65f75ff8ddd070f8150f3af0aa2e4988b2890c2dc498
6
+ metadata.gz: 3bf2d9199a22c3a1a6f0c81538d93e87f4aacf073c52866fed0d07156f44af98d059c6559071554e275dc754bfd5413284acebf841e59f11659acfa9527827bc
7
+ data.tar.gz: 8b249d54deee18c77faebe8da95eda1ff6bae624daf67f9db1e54225951fca9259c5ef58f0c22393806ec5225c007f6962cdb377eff572a2bc20c97bb5c48859
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Changed
6
+
7
+ * **[BREAKING]** Removed `Camille::Type#test` in favour of `Camille::Type#check`.
8
+ * Decimal and DateTime types are no longer generated for installation.
9
+
3
10
  ## 0.6.4
4
11
 
5
12
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- camille (0.6.3)
4
+ camille (0.6.4)
5
5
  rails (>= 6.1, < 8.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -29,10 +29,6 @@ Therefore, if the front-end requests the API by calling `data`, we have guarante
29
29
 
30
30
  By using these request functions, we also don't need to know about HTTP verbs and paths. It's impossible to have unrecognized routes, since Camille will make sure that each function handled by the correct Rails action.
31
31
 
32
- ## Tutorial
33
-
34
- There's a step by step tutorial for setting up and showcasing Camille: https://github.com/onyxblade/camille-tutorial.
35
-
36
32
  ## Installation
37
33
 
38
34
  Add this line to your application's Gemfile:
@@ -128,14 +124,15 @@ Each custom type is considered a type alias in TypeScript. And `alias_of` define
128
124
  type Product = {id: number, name: string}
129
125
  ```
130
126
 
131
- You can perform a type check on a value using `test`, which might be handy in testing:
127
+ You can perform a type check on a value using `check`, which can be handy in testing:
132
128
 
133
129
  ```ruby
134
- error = Camille::Types::Product.test(hash)
135
- if error.nil?
130
+ # `check` will return either a Camille::Checked or a Camille::TypeError
131
+ result = Camille::Types::Product.check(hash)
132
+ if result.checked?
136
133
  # the hash is accepted by Camille::Types::Product type
137
134
  else
138
- p error
135
+ p result
139
136
  end
140
137
  ```
141
138
 
@@ -161,7 +158,7 @@ params(
161
158
  # an array of objects also works
162
159
  object_array: {
163
160
  field: Number
164
- }[]
161
+ }[],
165
162
  # a union type is two types connected by '|'
166
163
  union: Number | String,
167
164
  # an intersection type is two types connected by '&'
@@ -264,6 +261,10 @@ object:
264
261
 
265
262
  Everything in `config/camille/types` and `config/camille/schemas` will automatically reload after changes in development environment, just like other files in Rails.
266
263
 
264
+ ## Versioning
265
+
266
+ This project uses [Semantic Versioning](https://semver.org/).
267
+
267
268
  ## Development
268
269
 
269
270
  Run tests with `bundle exec rake`.
@@ -10,15 +10,14 @@ module Camille
10
10
  copy_file "configuration.rb", "config/camille/configuration.rb"
11
11
  end
12
12
 
13
- def create_date_time_and_decimal
14
- copy_file "date_time.rb", "config/camille/types/date_time.rb"
15
- copy_file "decimal.rb", "config/camille/types/decimal.rb"
16
- end
17
-
18
13
  def create_schemas_folder
19
14
  copy_file ".keep", "config/camille/schemas/.keep"
20
15
  end
21
16
 
17
+ def create_types_folder
18
+ copy_file ".keep", "config/camille/types/.keep"
19
+ end
20
+
22
21
  end
23
22
  end
24
23
  end
data/lib/camille/type.rb CHANGED
@@ -23,13 +23,8 @@ module Camille
23
23
  @underlying.check value
24
24
  end
25
25
 
26
- def test value
27
- result = check value
28
- result.type_error? ? result : nil
29
- end
30
-
31
- def self.test value
32
- new.test value
26
+ def self.check value
27
+ new.check value
33
28
  end
34
29
 
35
30
  def self.klass_name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Camille
4
- VERSION = "0.6.4"
4
+ VERSION = "1.0.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camille
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - merely
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-18 00:00:00.000000000 Z
11
+ date: 2025-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails