diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2023-01-11 11:00:58 +0100 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2023-01-11 11:00:58 +0100 |
commit | 38871ad4e5e3b367256ac0a950b2ed7eb0335091 (patch) | |
tree | 47043061be46b3466372c51ad139fadd141a2cf6 | |
parent | 4db734783f7502a0b375d446409261a242dfb457 (diff) | |
download | psych-38871ad4e5e3b367256ac0a950b2ed7eb0335091.tar.gz |
Get rid of anonymous eval calls
Things declared in anonymous eval are always annoying to locate.
-rw-r--r-- | lib/psych/class_loader.rb | 2 | ||||
-rw-r--r-- | lib/psych/tree_builder.rb | 4 | ||||
-rw-r--r-- | test/psych/test_encoding.rb | 4 | ||||
-rw-r--r-- | test/psych/test_parser.rb | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/lib/psych/class_loader.rb b/lib/psych/class_loader.rb index c2e4ea4..50efc35 100644 --- a/lib/psych/class_loader.rb +++ b/lib/psych/class_loader.rb @@ -35,7 +35,7 @@ module Psych constants.each do |const| konst = const_get const - class_eval <<~RUBY + class_eval <<~RUBY, __FILE__, __LINE__ + 1 def #{const.to_s.downcase} load #{konst.inspect} end diff --git a/lib/psych/tree_builder.rb b/lib/psych/tree_builder.rb index 414ca02..83115bd 100644 --- a/lib/psych/tree_builder.rb +++ b/lib/psych/tree_builder.rb @@ -41,7 +41,7 @@ module Psych Sequence Mapping }.each do |node| - class_eval %{ + class_eval <<~RUBY, __FILE__, __LINE__ + 1 def start_#{node.downcase}(anchor, tag, implicit, style) n = Nodes::#{node}.new(anchor, tag, implicit, style) set_start_location(n) @@ -54,7 +54,7 @@ module Psych set_end_location(n) n end - } + RUBY end ### diff --git a/test/psych/test_encoding.rb b/test/psych/test_encoding.rb index 7d33814..1867d59 100644 --- a/test/psych/test_encoding.rb +++ b/test/psych/test_encoding.rb @@ -13,13 +13,13 @@ module Psych (Handler.instance_methods(true) - Object.instance_methods).each do |m| - class_eval %{ + class_eval <<~RUBY, __FILE__, __LINE__ + 1 def #{m} *args @strings += args.flatten.find_all { |a| String === a } end - } + RUBY end end diff --git a/test/psych/test_parser.rb b/test/psych/test_parser.rb index e087e31..3b67a8e 100644 --- a/test/psych/test_parser.rb +++ b/test/psych/test_parser.rb @@ -16,13 +16,13 @@ module Psych (Handler.instance_methods(true) - Object.instance_methods).each do |m| - class_eval %{ + class_eval <<~RUBY, __FILE__, __LINE__ + 1 def #{m} *args super @marks << @parser.mark if @parser @calls << [:#{m}, args] end - } + RUBY end end |