Skip to content

Commit 37f9fca

Browse files
authored
Merge pull request #245 from orbcorp/release-please--branches--main--changes--next
release: 0.1.1
2 parents 2e80f68 + 1780402 commit 37f9fca

File tree

7 files changed

+34
-17
lines changed

7 files changed

+34
-17
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0"
2+
".": "0.1.1"
33
}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 0.1.1 (2025-04-08)
4+
5+
Full Changelog: [v0.1.0...v0.1.1](https://github.com/orbcorp/orb-ruby/compare/v0.1.0...v0.1.1)
6+
7+
### Chores
8+
9+
* **internal:** version bump ([ef344e2](https://github.com/orbcorp/orb-ruby/commit/ef344e295d437e08f33fc7091a89be121ee6c5e9))
10+
* loosen const and integer coercion rules ([#246](https://github.com/orbcorp/orb-ruby/issues/246)) ([715a138](https://github.com/orbcorp/orb-ruby/commit/715a138f44ddf1eaf26c4ffec32178f8591eb8d0))
11+
312
## 0.1.0 (2025-04-08)
413

514
Full Changelog: [v0.1.0-alpha.39...v0.1.0](https://github.com/orbcorp/orb-ruby/compare/v0.1.0-alpha.39...v0.1.0)

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GIT
1111
PATH
1212
remote: .
1313
specs:
14-
orb-billing (0.1.0.pre.alpha.39)
14+
orb-billing (0.1.0)
1515
connection_pool
1616

1717
GEM

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
1515
<!-- x-release-please-start-version -->
1616

1717
```ruby
18-
gem "orb-billing", "~> 0.1.0.pre.alpha.39"
18+
gem "orb-billing", "~> 0.1.0"
1919
```
2020

2121
<!-- x-release-please-end -->

lib/orb/internal/type/converter.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ def coerce(
149149
if value.is_a?(Integer)
150150
exactness[:yes] += 1
151151
return value
152-
elsif strictness == :strong
152+
elsif strictness == :strong && Integer(value, exception: false) != value
153153
message = "no implicit conversion of #{value.class} into #{target.inspect}"
154-
raise TypeError.new(message)
154+
raise value.is_a?(Numeric) ? ArgumentError.new(message) : TypeError.new(message)
155155
else
156156
Kernel.then do
157157
return Integer(value).tap { exactness[:maybe] += 1 }
@@ -197,12 +197,20 @@ def coerce(
197197
else
198198
end
199199
in Symbol
200-
if (value.is_a?(Symbol) || value.is_a?(String)) && value.to_sym == target
201-
exactness[:yes] += 1
202-
return target
203-
elsif strictness == :strong
204-
message = "cannot convert non-matching #{value.class} into #{target.inspect}"
205-
raise ArgumentError.new(message)
200+
case value
201+
in Symbol | String
202+
if value.to_sym == target
203+
exactness[:yes] += 1
204+
return target
205+
else
206+
exactness[:maybe] += 1
207+
return value
208+
end
209+
else
210+
if strictness == :strong
211+
message = "cannot convert non-matching #{value.class} into #{target.inspect}"
212+
raise ArgumentError.new(message)
213+
end
206214
end
207215
else
208216
end

lib/orb/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Orb
4-
VERSION = "0.1.0"
4+
VERSION = "0.1.1"
55
end

test/orb/internal/type/base_model_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def test_coerce_errors
111111
[Integer, "one"] => TypeError,
112112
[Float, "one"] => TypeError,
113113
[String, Time] => TypeError,
114-
[:a, "one"] => ArgumentError,
115114
[Date, "one"] => ArgumentError,
116115
[Time, "one"] => ArgumentError
117116
}
@@ -346,7 +345,7 @@ def test_coerce
346345
[M2, {a: "1990-09-19", c: nil}] => [{yes: 2, maybe: 2}, {a: "1990-09-19", c: nil}],
347346

348347
[M3, {c: "c", d: "d"}] => [{yes: 3}, {c: :c, d: :d}],
349-
[M3, {c: "d", d: "c"}] => [{yes: 1, no: 2}, {c: "d", d: "c"}],
348+
[M3, {c: "d", d: "c"}] => [{yes: 1, maybe: 2}, {c: "d", d: "c"}],
350349

351350
[M4, {c: 2}] => [{yes: 5}, {c: 2}],
352351
[M4, {a: "1", c: 2}] => [{yes: 4, maybe: 1}, {a: "1", c: 2}],
@@ -404,7 +403,8 @@ def test_accessors
404403
cases = {
405404
M2.new({a: "1990-09-19", b: "1"}) => {a: Time.new(1990, 9, 19), b: TypeError},
406405
M2.new(a: "one", b: "one") => {a: ArgumentError, b: TypeError},
407-
M2.new(a: nil, b: 2.0) => {a: TypeError, b: TypeError},
406+
M2.new(a: nil, b: 2.0) => {a: TypeError},
407+
M2.new(a: nil, b: 2.2) => {a: TypeError, b: ArgumentError},
408408

409409
M3.new => {d: :d},
410410
M3.new(d: 1) => {d: ArgumentError},
@@ -520,8 +520,8 @@ def test_coerce
520520
[U0, :""] => [{no: 1}, 0, :""],
521521

522522
[U1, "a"] => [{yes: 1}, 1, :a],
523-
[U1, "2"] => [{maybe: 1}, 2, 2],
524-
[U1, :b] => [{no: 1}, 2, :b],
523+
[U1, "2"] => [{maybe: 1}, 2, "2"],
524+
[U1, :b] => [{maybe: 1}, 2, :b],
525525

526526
[U2, {type: :a}] => [{yes: 3}, 0, {t: :a}],
527527
[U2, {type: "b"}] => [{yes: 3}, 0, {type: :b}],

0 commit comments

Comments
 (0)