Skip to content

Commit 9efe1a0

Browse files
committed
Fixed compilation error with Rice 4.6
1 parent 77cd493 commit 9efe1a0

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.15.1 (unreleased)
2+
3+
- Fixed compilation error with Rice 4.6
4+
15
## 0.15.0 (2025-02-17)
26

37
- Updated OR-Tools to 9.12

ext/or-tools/routing.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ void init_routing(Rice::Module& m) {
250250
})
251251
.define_method(
252252
"cumulative",
253-
[](operations_research::Solver& self, std::vector<operations_research::IntervalVar*> intervals, std::vector<int64_t> demands, int64_t capacity, const std::string& name) {
253+
[](operations_research::Solver& self, Array rb_intervals, std::vector<int64_t> demands, int64_t capacity, const std::string& name) {
254+
std::vector<operations_research::IntervalVar*> intervals;
255+
for (const Object v : rb_intervals) {
256+
intervals.push_back(Rice::detail::From_Ruby<operations_research::IntervalVar*>().convert(v.value()));
257+
}
254258
return self.MakeCumulative(intervals, demands, capacity, name);
255259
});
256260

or-tools.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ Gem::Specification.new do |spec|
1616

1717
spec.required_ruby_version = ">= 3.1"
1818

19-
spec.add_dependency "rice", "~> 4.5.0"
19+
spec.add_dependency "rice", ">= 4.5.0"
2020
end

test/constraint_test.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,10 @@ def test_add_hint
229229
model.add_hint(x, 1)
230230
model.add_hint(y, true)
231231

232-
assert_raises(TypeError) do
232+
error = assert_raises(RuntimeError) do
233233
model.add_hint("z", 1)
234234
end
235+
assert_equal "The provided Ruby object does not wrap a C++ object", error.message
235236
end
236237

237238
def test_int_var_domain

0 commit comments

Comments
 (0)