Skip to content

Commit

Permalink
Fix load know classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ceritium committed Mar 24, 2024
1 parent b963c5f commit a3ffa1f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions lib/flatito/yaml_with_line_number.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/with_ruby_objects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions test/flatito/flatten_yaml_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 6, items[2].line
end

test "items from content with duplicated keys" do
Expand Down

0 comments on commit a3ffa1f

Please sign in to comment.