Skip to content

Commit

Permalink
Remove BigDecimal dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed Jan 25, 2025
1 parent c9c42ce commit 49e6832
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All changes to the Ox gem are documented here. Releases follow semantic versioning.

## [2.14.21] - 2025-01-15

### Fixed

- Removed internal dependency on BigDecimal. If BigDecimal is use it
must now be included in the calling code. This was forced by the
change in BigDecimal no longer being included in the Ruby core.

## [2.14.20] - 2025-01-12

### Fixed
Expand Down
5 changes: 1 addition & 4 deletions ext/ox/ox.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ VALUE ox_sym_bank; // Array

VALUE ox_arg_error_class;
VALUE ox_bag_clas;
VALUE ox_bigdecimal_class;
VALUE ox_cdata_clas;
VALUE ox_comment_clas;
VALUE ox_raw_clas;
Expand Down Expand Up @@ -1399,7 +1398,7 @@ void Init_ox(void) {

rb_require("time");
rb_require("date");
rb_require("bigdecimal");
// rb_require("bigdecimal");
rb_require("stringio");

ox_abort_id = rb_intern("abort");
Expand Down Expand Up @@ -1471,7 +1470,6 @@ void Init_ox(void) {
ox_arg_error_class = rb_const_get_at(Ox, rb_intern("ArgError"));
ox_struct_class = rb_const_get(rb_cObject, rb_intern("Struct"));
ox_stringio_class = rb_const_get(rb_cObject, rb_intern("StringIO"));
ox_bigdecimal_class = rb_const_get(rb_cObject, rb_intern("BigDecimal"));

abort_sym = ID2SYM(rb_intern("abort"));
rb_gc_register_address(&abort_sym);
Expand Down Expand Up @@ -1589,7 +1587,6 @@ void Init_ox(void) {
rb_gc_register_address(&ox_arg_error_class);
rb_gc_register_address(&ox_bag_clas);
rb_gc_register_address(&ox_bag_clas);
rb_gc_register_address(&ox_bigdecimal_class);
rb_gc_register_address(&ox_cdata_clas);
rb_gc_register_address(&ox_cdata_clas);
rb_gc_register_address(&ox_comment_clas);
Expand Down
1 change: 0 additions & 1 deletion ext/ox/ox.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ extern VALUE ox_sym_bank; // Array
extern VALUE ox_version_sym;
extern VALUE ox_zero_fixnum;

extern VALUE ox_bigdecimal_class;
extern VALUE ox_date_class;
extern VALUE ox_stringio_class;
extern VALUE ox_struct_class;
Expand Down
2 changes: 1 addition & 1 deletion lib/ox/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ox
# Current version of the module.
VERSION = '2.14.20'
VERSION = '2.14.21'
end
8 changes: 4 additions & 4 deletions test/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# required. That can be set in the RUBYOPT environment variable.
# export RUBYOPT=-w

# frozen_string_literal: true

$VERBOSE = true

$: << File.join(File.dirname(__FILE__), '../lib')
Expand Down Expand Up @@ -836,9 +838,6 @@ def test_circular
a << e
a << b
loaded = dump_and_load(b, false, true)
# modify the string
loaded.instance_variable_get(:@s).gsub!(',', '_')
b.instance_variable_get(:@s).gsub!(',', '_')
# modify hash
loaded.instance_variable_get(:@h)[1] = 3
b.instance_variable_get(:@h)[1] = 3
Expand Down Expand Up @@ -1915,7 +1914,8 @@ def test_key_mod

def test_encoding_ascii
Ox.default_options = $ox_generic_options
xml = '<?xml version="1.0" encoding="UTF-8" ?><text>H&#233;ra&#239;dios</text>'.force_encoding(Encoding::ASCII_8BIT)
xml = '<?xml version="1.0" encoding="UTF-8" ?><text>H&#233;ra&#239;dios</text>'.dup
xml.force_encoding(Encoding::ASCII_8BIT)
text = Ox.load(xml).root.text
assert_equal('Héraïdios', text)
assert_equal(Encoding::UTF_8, text.encoding)
Expand Down

0 comments on commit 49e6832

Please sign in to comment.