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 +4 -4
 - data/README.md +1 -1
 - data/lib/literal/enum.rb +10 -1
 - data/lib/literal/types.rb +0 -15
 - data/lib/literal/version.rb +1 -1
 - metadata +6 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0d4ade41b16e56d3e05c85771d12ffedffa1e5d0c33998890c1fdd0b8b8503bf
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7bb21c5e0ab2318825dd19efe878f38db2469f3a6f500615ebf2300723b7438f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e56f4aaefec78d299254174dcf6a5aded7cb59970291ef55bdb3a88392c230d26efe07c8a18471c9484acd5e6f477f63b6639e7accf712ca7c9aad18720cd84f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a60595864a2f267ded92ca14603eb74b0b42deddfa2167fd582e5ebfaee83f0348569d498755e03e088a83ff647149c1159d8758fbb3c4a1c4ebada0d43a0571
         
     | 
    
        data/README.md
    CHANGED
    
    
    
        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(: 
     | 
| 
      
 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(...)
         
     | 
    
        data/lib/literal/version.rb
    CHANGED
    
    
    
        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 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-11-01 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
     | 
    
         
            -
            description:  
     | 
| 
      
 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:// 
     | 
| 
      
 74 
     | 
    
         
            +
            homepage: https://literal.fun
         
     | 
| 
       75 
75 
     | 
    
         
             
            licenses:
         
     | 
| 
       76 
76 
     | 
    
         
             
            - MIT
         
     | 
| 
       77 
77 
     | 
    
         
             
            metadata:
         
     | 
| 
       78 
     | 
    
         
            -
              homepage_uri: https:// 
     | 
| 
      
 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:  
     | 
| 
      
 101 
     | 
    
         
            +
            summary: Enums, properties, generics, structured objects and runtime type checking.
         
     | 
| 
       102 
102 
     | 
    
         
             
            test_files: []
         
     |