From 4f33bd950e3f644c972b7ecbcd2809bb084132ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Galisteo?= Date: Sun, 24 Mar 2024 18:40:08 +0100 Subject: [PATCH] Fix load know classes --- lib/flatito/yaml_with_line_number.rb | 2 -- test/fixtures/with_ruby_objects.yml | 2 +- test/flatito/flatten_yaml_test.rb | 4 ++++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/flatito/yaml_with_line_number.rb b/lib/flatito/yaml_with_line_number.rb index e70fbd3..2c0e90b 100644 --- a/lib/flatito/yaml_with_line_number.rb +++ b/lib/flatito/yaml_with_line_number.rb @@ -30,8 +30,6 @@ def respond_to_missing?(*) class ClassLoader < Psych::ClassLoader def find(klassname) - @cache[klassname] ||= resolve(klassname) - rescue ArgumentError Whatever.new(klassname) end end diff --git a/test/fixtures/with_ruby_objects.yml b/test/fixtures/with_ruby_objects.yml index b52c464..d667799 100644 --- a/test/fixtures/with_ruby_objects.yml +++ b/test/fixtures/with_ruby_objects.yml @@ -3,6 +3,6 @@ two: !ruby/object:OpenStruct table: one: One two: Two -three: !ruby/object:UnknowClass +three: !ruby/object:UnknownClass one: One two: Two diff --git a/test/flatito/flatten_yaml_test.rb b/test/flatito/flatten_yaml_test.rb index fba5791..d559775 100644 --- a/test/flatito/flatten_yaml_test.rb +++ b/test/flatito/flatten_yaml_test.rb @@ -74,6 +74,10 @@ class Flatito::FlattenYamlTest < Minitest::Test assert_equal "two", items[1].key assert_equal "[object: OpenStruct]", items[1].value assert_equal 2, items[1].line + + assert_equal "three", items[2].key + assert_equal "[object: UnknownClass]", items[2].value + assert_equal 3, items[2].line end test "items from content with duplicated keys" do