crystalruby 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/lib/crystalruby/template.rb +0 -1
- data/lib/crystalruby/typebuilder.rb +0 -112
- data/lib/crystalruby/version.rb +1 -1
- data/logo.png +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8dc48667be65ee6e6d36ba7efcfc87dfefb133a06cb375a22297db9643221e3
|
4
|
+
data.tar.gz: 40753b3741ae9fb5dec86019d35968027517280a08ae6bffbcf8f2e207fe96b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1682a4405fd2baf66a93fc913af2146fa11e9806b90c8d6ac6d0eebc496b30415204474bd841377e3ea409401608f2907f58d7b717b21520cd4b1fe04d825d86
|
7
|
+
data.tar.gz: 8682ebdcdd83bda6ab29261cdfc627afe1bd211343bc4caa95c9f08cbb30fba663f1aebcf4df1535e27d7a84377449d5028afcce145cc0a91c153721e2d261f1
|
data/README.md
CHANGED
@@ -1,4 +1,19 @@
|
|
1
|
-
|
1
|
+
<table>
|
2
|
+
<tr>
|
3
|
+
<td><img src="logo.png" alt="logo" width="150"></td>
|
4
|
+
<td>
|
5
|
+
<h1 align="center">crystalruby</h1>
|
6
|
+
<p align="center">
|
7
|
+
<a href="https://rubygems.org/gems/crystalruby">
|
8
|
+
<img alt="GEM Version" src="https://img.shields.io/gem/v/crystalruby?color=168AFE&include_prereleases&logo=ruby&logoColor=FE1616">
|
9
|
+
</a><br>
|
10
|
+
<a href="https://rubygems.org/gems/crystalruby">
|
11
|
+
<img alt="GEM Downloads" src="https://img.shields.io/gem/dt/crystalruby?color=168AFE&logo=ruby&logoColor=FE1616">
|
12
|
+
</a>
|
13
|
+
</p>
|
14
|
+
</td>
|
15
|
+
</tr>
|
16
|
+
</table>
|
2
17
|
|
3
18
|
`crystalruby` is a gem that allows you to write Crystal code, inlined in Ruby. All you need is a modern crystal compiler installed on your system.
|
4
19
|
|
@@ -310,7 +325,6 @@ It should support escape hatches to allow it to coexist with code that performs
|
|
310
325
|
The library is currently in its infancy. Planned additions are:
|
311
326
|
|
312
327
|
- Replace existing checksum process, with one that combines results of inline and external crystal to more accurately detect when recompilation is necessary.
|
313
|
-
- Support for automatic serialization of nested data structures (holding _ONLY_ primitives), using JSON as our serialization protocol (prioritizing portability over raw serialization performance. JSON generation and parsing is bundled into the stdlib in both languages).
|
314
328
|
- Simple mixin/concern that utilises `FFI::Struct` for bi-directional passing of Ruby objects and Crystal objects (by value).
|
315
329
|
- Install command to generate a sample build script, and supports build command (which simply verifies then invokes this script)
|
316
330
|
- Call Ruby from Crystal using FFI callbacks (implement `.expose_to_crystal`)
|
data/lib/crystalruby/template.rb
CHANGED
@@ -65,115 +65,3 @@ module CrystalRuby
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
69
|
-
# class UnionType
|
70
|
-
# attr_reader :inner
|
71
|
-
|
72
|
-
# def initialize(*inner)
|
73
|
-
# @inner = inner
|
74
|
-
# end
|
75
|
-
|
76
|
-
# def |(other)
|
77
|
-
# UnionType.new(*inner, *other.inner)
|
78
|
-
# end
|
79
|
-
|
80
|
-
# def inspect
|
81
|
-
# elements = inner.map(&:inspect).join(" | ")
|
82
|
-
# end
|
83
|
-
# end
|
84
|
-
|
85
|
-
# class Type
|
86
|
-
# attr_reader :inner, :contains
|
87
|
-
|
88
|
-
# def initialize(name)
|
89
|
-
# @name = name
|
90
|
-
# @contains = contains
|
91
|
-
# @inner = [self]
|
92
|
-
# end
|
93
|
-
|
94
|
-
# def |(other)
|
95
|
-
# UnionType.new(*inner, *other.inner)
|
96
|
-
# end
|
97
|
-
|
98
|
-
# def inspect
|
99
|
-
# if @contains
|
100
|
-
# "#{@name}(#{@contains.inspect})"
|
101
|
-
# else
|
102
|
-
# @name
|
103
|
-
# end
|
104
|
-
# end
|
105
|
-
# end
|
106
|
-
|
107
|
-
# module_function
|
108
|
-
|
109
|
-
# %w[
|
110
|
-
# Bool Uint8 Uint16 Uint32 Uint64 Int8 Int16 Int32 Int64 Float32 Float64 String Time Symbol
|
111
|
-
# Null
|
112
|
-
# ].map do |t|
|
113
|
-
# cls = Class.new(Type)
|
114
|
-
# const_set(t, cls)
|
115
|
-
# define_method(t.downcase) do
|
116
|
-
# cls.new(t)
|
117
|
-
# end
|
118
|
-
# end
|
119
|
-
|
120
|
-
# def build(&blk)
|
121
|
-
# instance_exec(&blk)
|
122
|
-
# end
|
123
|
-
|
124
|
-
# def hash(key_type, value_type)
|
125
|
-
# Hash.new(key_type, value_type)
|
126
|
-
# end
|
127
|
-
|
128
|
-
# def array(type)
|
129
|
-
# Array.new(type)
|
130
|
-
# end
|
131
|
-
|
132
|
-
# def tuple(*types)
|
133
|
-
# Tuple.new(*types)
|
134
|
-
# end
|
135
|
-
|
136
|
-
# def named_tuple(type_hash)
|
137
|
-
# NamedTuple.new(type_hash)
|
138
|
-
# end
|
139
|
-
|
140
|
-
# def NamedTuple(type_hash)
|
141
|
-
# NamedTuple.new(type_hash)
|
142
|
-
# end
|
143
|
-
|
144
|
-
# class Hash < Type
|
145
|
-
# HASH_KEY_TYPES = %w[String Symbol].freeze
|
146
|
-
# def initialize(key_type, value_type)
|
147
|
-
# super("Hash")
|
148
|
-
# @key_type = key_type
|
149
|
-
# @value_type = value_type
|
150
|
-
# raise "Invalid key type" unless [Uint8, Uint16, Uint32, Uint64, Int8, Int16, Int32, Int64,
|
151
|
-
# String].include?(key_type)
|
152
|
-
# raise "Invalid value type" unless value_type.is_a?(Type)
|
153
|
-
# end
|
154
|
-
# end
|
155
|
-
|
156
|
-
# class Array < Type
|
157
|
-
# def initialize(value_type)
|
158
|
-
# super("Array")
|
159
|
-
# @value_type = value_type
|
160
|
-
# raise "Invalid value type" unless value_type.is_a?(Type)
|
161
|
-
# end
|
162
|
-
# end
|
163
|
-
|
164
|
-
# class NamedTuple < Type
|
165
|
-
# def initialize(types_hash)
|
166
|
-
# raise "keys must be symbols" unless types_hash.keys.all? { |k| k.is_a?(Symbol) }
|
167
|
-
# raise "Invalid value type" unless types_hash.values.all? { |v| v.is_a?(Type) }
|
168
|
-
|
169
|
-
# super("NamedTuple")
|
170
|
-
# @types_hash = types_hash
|
171
|
-
# end
|
172
|
-
# end
|
173
|
-
|
174
|
-
# class Tuple < Type
|
175
|
-
# def initialize(*value_types)
|
176
|
-
# super("Tuple")
|
177
|
-
# raise "Invalid value type" unless value_types.all? { |v| v.is_a?(Type) }
|
178
|
-
# end
|
179
|
-
# end
|
data/lib/crystalruby/version.rb
CHANGED
data/logo.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crystalruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wouter Coppieters
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- lib/crystalruby/types/union_type.rb
|
108
108
|
- lib/crystalruby/version.rb
|
109
109
|
- lib/module.rb
|
110
|
+
- logo.png
|
110
111
|
- sig/crystalruby.rbs
|
111
112
|
homepage: https://github.com/wouterken/crystalruby
|
112
113
|
licenses:
|