literal 1.0.0.rc1 → 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: 75c7cc8853143bd8f4ac74b7fc4a5b5d2812bd39c0b4f696a87c2ffc0fb31046
4
- data.tar.gz: 7781d6362e9ae8f75d0156809f95b0c1f8a37df855356173c9b6f09428419bc0
3
+ metadata.gz: 0d4ade41b16e56d3e05c85771d12ffedffa1e5d0c33998890c1fdd0b8b8503bf
4
+ data.tar.gz: 7bb21c5e0ab2318825dd19efe878f38db2469f3a6f500615ebf2300723b7438f
5
5
  SHA512:
6
- metadata.gz: 6acc2552c11ff3c5f12877b5597f9a6a138bf4901f5fce3801004e286b522c6263fa2454621ac4f5511f553af073d5113d96cd1af1045bc9e44c014c15ab7420
7
- data.tar.gz: 6f9b205b3343426385185ebd0ea0e04164f6a06f9d42d6cb34c542c8d12a98ab327e274b336fb13d389e7380f5bd79831eb2b508f2d019cd6143658db40f3195
6
+ metadata.gz: e56f4aaefec78d299254174dcf6a5aded7cb59970291ef55bdb3a88392c230d26efe07c8a18471c9484acd5e6f477f63b6639e7accf712ca7c9aad18720cd84f
7
+ data.tar.gz: a60595864a2f267ded92ca14603eb74b0b42deddfa2167fd582e5ebfaee83f0348569d498755e03e088a83ff647149c1159d8758fbb3c4a1c4ebada0d43a0571
data/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # A Literal Ruby Gem [WIP]
1
+ # A Literal Ruby Gem
2
2
 
3
3
  See the website for [documentation](https://literal.fun/docs).
data/lib/literal/enum.rb CHANGED
@@ -142,8 +142,17 @@ class Literal::Enum
142
142
  @values.fetch(...)
143
143
  end
144
144
 
145
+ def coerce(value)
146
+ case value
147
+ when self
148
+ value
149
+ else
150
+ self[value]
151
+ end
152
+ end
153
+
145
154
  def to_proc
146
- method(:cast).to_proc
155
+ method(:coerce).to_proc
147
156
  end
148
157
 
149
158
  def to_h(*args)
data/lib/literal/types.rb CHANGED
@@ -25,7 +25,6 @@ module Literal::Types
25
25
  autoload :ProcableType, "literal/types/procable_type"
26
26
  autoload :RangeType, "literal/types/range_type"
27
27
  autoload :SetType, "literal/types/set_type"
28
- autoload :ShapeType, "literal/types/shape_type"
29
28
  autoload :StringType, "literal/types/string_type"
30
29
  autoload :SymbolType, "literal/types/symbol_type"
31
30
  autoload :TruthyType, "literal/types/truthy_type"
@@ -293,20 +292,6 @@ module Literal::Types
293
292
  )
294
293
  end
295
294
 
296
- # Ensures a value matches the given shape of a Hash
297
- def _Shape(...)
298
- ShapeType.new(...)
299
- end
300
-
301
- # Nilable version of `_Shape`
302
- def _Shape?(...)
303
- NilableType.new(
304
- ShapeType.new(...),
305
- )
306
- end
307
-
308
- # Nilable version of `_Shape`
309
-
310
295
  # Matches if the value is a `String` and matches the given constraints.
311
296
  # If you don't need any constraints, use `String` instead of `_String`.
312
297
  def _String(...)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Literal
4
- VERSION = "1.0.0.rc1"
4
+ VERSION = "1.0.0"
5
5
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: literal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Drapper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-26 00:00:00.000000000 Z
11
+ date: 2024-11-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Enums, properties, generics, structured objects.
13
+ description: A literal Ruby gem.
14
14
  email:
15
15
  - joel@drapper.me
16
16
  executables: []
@@ -71,11 +71,11 @@ files:
71
71
  - lib/literal/types/union_type.rb
72
72
  - lib/literal/types/void_type.rb
73
73
  - lib/literal/version.rb
74
- homepage: https://github.com/joeldrapper/literal
74
+ homepage: https://literal.fun
75
75
  licenses:
76
76
  - MIT
77
77
  metadata:
78
- homepage_uri: https://github.com/joeldrapper/literal
78
+ homepage_uri: https://literal.fun
79
79
  source_code_uri: https://github.com/joeldrapper/literal
80
80
  changelog_uri: https://github.com/joeldrapper/literal/blob/main/CHANGELOG.md
81
81
  funding_uri: https://github.com/sponsors/joeldrapper
@@ -98,5 +98,5 @@ requirements: []
98
98
  rubygems_version: 3.5.18
99
99
  signing_key:
100
100
  specification_version: 4
101
- summary: A literal Ruby gem.
101
+ summary: Enums, properties, generics, structured objects and runtime type checking.
102
102
  test_files: []