Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F34451972
splat
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
jbond
May 12 2021, 5:02 PM
2021-05-12 17:02:29 (UTC+0)
Size
916 B
Referenced Files
None
Subscribers
None
splat
View Options
def no_splat(splat, &block)
block.call(splat)
end
def splat_call(splat, &block)
block.call(*splat)
end
def splat_param(*splat, &block)
block.call(splat)
end
%w[no_splat splat_call splat_param].each do |func|
puts "testing: #{func}\n"
result = ''
begin
send(func, [1,2]) do |recv|
result = recv.inspect
end
rescue
result = 'Failed'
end
puts "Array:\t\t#{result.inspect}"
begin
send(func, [1,2]) do |*recv|
result = recv.inspect
end
rescue
result = 'Failed'
end
puts "Array splat recv:\t\t#{result.inspect}"
begin
send(func, *[1,2]) do |recv|
result = recv.inspect
end
rescue
result = 'Failed'
end
puts "Positional:\t\t#{result.inspect}"
begin
send(func, *[1,2]) do |*recv|
result = recv.inspect
end
rescue
result = 'Failed'
end
puts "Positional splat recv:\t\t#{result.inspect}"
puts "\n\n"
end
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9071746
Default Alt Text
splat (916 B)
Attached To
Mode
P15953 splat
Attached
Detach File
Event Timeline
Log In to Comment