[ruby/psych] Get rid of anonymous eval calls
Things declared in anonymous eval are always annoying to locate. https://github.com/ruby/psych/commit/38871ad4e5
This commit is contained in:
parent
e85ef212de
commit
3161fd4372
@ -35,7 +35,7 @@ module Psych
|
|||||||
|
|
||||||
constants.each do |const|
|
constants.each do |const|
|
||||||
konst = const_get const
|
konst = const_get const
|
||||||
class_eval <<~RUBY
|
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
||||||
def #{const.to_s.downcase}
|
def #{const.to_s.downcase}
|
||||||
load #{konst.inspect}
|
load #{konst.inspect}
|
||||||
end
|
end
|
||||||
|
@ -41,7 +41,7 @@ module Psych
|
|||||||
Sequence
|
Sequence
|
||||||
Mapping
|
Mapping
|
||||||
}.each do |node|
|
}.each do |node|
|
||||||
class_eval %{
|
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
||||||
def start_#{node.downcase}(anchor, tag, implicit, style)
|
def start_#{node.downcase}(anchor, tag, implicit, style)
|
||||||
n = Nodes::#{node}.new(anchor, tag, implicit, style)
|
n = Nodes::#{node}.new(anchor, tag, implicit, style)
|
||||||
set_start_location(n)
|
set_start_location(n)
|
||||||
@ -54,7 +54,7 @@ module Psych
|
|||||||
set_end_location(n)
|
set_end_location(n)
|
||||||
n
|
n
|
||||||
end
|
end
|
||||||
}
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -13,13 +13,13 @@ module Psych
|
|||||||
|
|
||||||
(Handler.instance_methods(true) -
|
(Handler.instance_methods(true) -
|
||||||
Object.instance_methods).each do |m|
|
Object.instance_methods).each do |m|
|
||||||
class_eval %{
|
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
||||||
def #{m} *args
|
def #{m} *args
|
||||||
@strings += args.flatten.find_all { |a|
|
@strings += args.flatten.find_all { |a|
|
||||||
String === a
|
String === a
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
}
|
RUBY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -16,13 +16,13 @@ module Psych
|
|||||||
|
|
||||||
(Handler.instance_methods(true) -
|
(Handler.instance_methods(true) -
|
||||||
Object.instance_methods).each do |m|
|
Object.instance_methods).each do |m|
|
||||||
class_eval %{
|
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
||||||
def #{m} *args
|
def #{m} *args
|
||||||
super
|
super
|
||||||
@marks << @parser.mark if @parser
|
@marks << @parser.mark if @parser
|
||||||
@calls << [:#{m}, args]
|
@calls << [:#{m}, args]
|
||||||
end
|
end
|
||||||
}
|
RUBY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user