summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/axlsx/util/simple_typed_list.rb6
-rw-r--r--test/util/tc_simple_typed_list.rb11
3 files changed, 11 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 49cae46a..19f5d742 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@ CHANGELOG
- **Unreleased**: 4.0.0
- Drop support for Ruby versions < 2.6
- Added frozen string literals
+ - Fix `SimpleTypedList#to_a` and `SimpleTypedList#to_ary` returning the internal list instance
- **April.23.23**: 3.4.1
- [PR #209](https://github.com/caxlsx/caxlsx/pull/209) - Revert characters other than `=` being considered as formulas.
diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb
index 0798ee22..c3910fca 100644
--- a/lib/axlsx/util/simple_typed_list.rb
+++ b/lib/axlsx/util/simple_typed_list.rb
@@ -84,12 +84,6 @@ module Axlsx
self
end
- def to_ary
- @list
- end
-
- alias :to_a :to_ary
-
# join operator
# @param [Array] v the array to join
# @raise [ArgumentError] if any of the values being joined are not
diff --git a/test/util/tc_simple_typed_list.rb b/test/util/tc_simple_typed_list.rb
index b62b5353..1a3d907b 100644
--- a/test/util/tc_simple_typed_list.rb
+++ b/test/util/tc_simple_typed_list.rb
@@ -82,7 +82,16 @@ class TestSimpleTypedList < Test::Unit::TestCase
@list.push 1
@list.push 2
- assert_equal([1, 2], @list.to_ary)
+ assert_equal([1, 2], @list)
+ end
+
+ def test_to_a
+ refute_equal(@list.object_id, @list.to_a.object_id)
+ assert_instance_of(Array, @list.to_a)
+ end
+
+ def test_to_ary
+ assert_equal(@list.object_id, @list.to_ary.object_id)
end
def test_insert