crystalruby 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fde36eb6893b41f156d747996c94e803227552f4ef12097ead408bb823619d59
4
- data.tar.gz: 95e9860ee479571f1f38f8f7507a7f5eb921256116894c01ce358a8c0f22dc70
3
+ metadata.gz: 542a695dee21acb928d1c758ce8a48f31422b8b71940b6ea61d87c2744b3fc5c
4
+ data.tar.gz: 988da32111ca2a2a13f1b8da93c850a76ea6dda4191f55feabd768b35444e316
5
5
  SHA512:
6
- metadata.gz: 9b6c00ce61edf03f729bcd4f6605aa0cecb6042d9c046700a351d1ccf39b861fd5c259f7955ea02459984ee497533483adf3affbbae697fe5937ddd6ab01c625
7
- data.tar.gz: 383e9f782c49da8751535ea8ba8ac1fd5638f17fe4d5d6b163c7b9df9ea4171794effa51df0bde51ad892ddbb58c545d542455ea973cf60fe2cb530a898e34c4
6
+ metadata.gz: c5109478ed499c9737dc008cae0f720ae03d30a31bffb9add0034303ba7d39b943b437074fb033b52f307cb09f838d64a1a037b36f80bf985e4141614b8ec983
7
+ data.tar.gz: 4e1f0831bf0eb15a889ad7ca0bd797ae02377968f41b365593102663ff828b0791cd500871e6ba3145b4613a2ed797690ca0b4866e57ee18d9032ddee546aa96
data/README.md CHANGED
@@ -46,7 +46,7 @@ crystallize :int32
46
46
  def count_primes_upto_cr(n: Int32)
47
47
  (2..n).each.count do |i|
48
48
  is_prime = true
49
- (2..Math.sqrt(i).to_i).each do |j|
49
+ (2..Math.isqrt(i)).each do |j|
50
50
  if i % j == 0
51
51
  is_prime = false
52
52
  break
@@ -59,7 +59,7 @@ end
59
59
  def count_primes_upto_rb(n)
60
60
  (2..n).each.count do |i|
61
61
  is_prime = true
62
- (2..Math.sqrt(i).to_i).each do |j|
62
+ (2..Integer.sqrt(i)).each do |j|
63
63
  if i % j == 0
64
64
  is_prime = false
65
65
  break
@@ -1,8 +1,8 @@
1
1
  require "crystalruby"
2
2
 
3
3
  module Adder
4
- crystallize [a: :int, b: :int] => :int
5
- def add(a, b)
4
+ crystallize :int
5
+ def add(a: :int, b: :int)
6
6
  a + b
7
7
  end
8
8
  end
@@ -108,6 +108,9 @@ module CrystalRuby
108
108
  arg = crystalruby_type.new(arg) unless arg.is_a?(Types::Type)
109
109
  crystalruby_type.anonymous? ? arg.native : arg
110
110
  }
111
+ # Strings in Crystal are UTF-8 encoded by default
112
+ elsif crystalruby_type.equal?(:string)
113
+ ->(arg) { arg.force_encoding("UTF-8") }
111
114
  end,
112
115
  convert_crystal_to_lib_type: ->(expr) { convert_crystal_to_lib_type(expr, crystalruby_type) },
113
116
  convert_lib_to_crystal_type: ->(expr) { convert_lib_to_crystal_type(expr, crystalruby_type) }
@@ -12,7 +12,8 @@ module CrystalRuby::Types
12
12
  end
13
13
 
14
14
  def value(native: false)
15
- data_pointer.read_string(size)
15
+ # Strings in Crystal are UTF-8 encoded by default
16
+ data_pointer.read_string(size).force_encoding("UTF-8")
16
17
  end
17
18
  end
18
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CrystalRuby
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crystalruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
- original_platform: ''
7
6
  authors:
8
7
  - Wouter Coppieters
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-15 00:00:00.000000000 Z
11
+ date: 2024-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: digest
@@ -147,6 +147,7 @@ metadata:
147
147
  homepage_uri: https://github.com/wouterken/crystalruby
148
148
  source_code_uri: https://github.com/wouterken/crystalruby
149
149
  changelog_uri: https://github.com/wouterken/crystalruby/CHANGELOG.md
150
+ post_install_message:
150
151
  rdoc_options: []
151
152
  require_paths:
152
153
  - lib
@@ -161,7 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
162
  - !ruby/object:Gem::Version
162
163
  version: '0'
163
164
  requirements: []
164
- rubygems_version: 3.6.0.dev
165
+ rubygems_version: 3.5.22
166
+ signing_key:
165
167
  specification_version: 4
166
168
  summary: Embed Crystal code directly in Ruby.
167
169
  test_files: []