If obtaining a value for each element of the given array (presumably a hash) is cheap, you could write the following.
def test1(arr)
arr.find { |h| h[55] }&.[](55)
end
else I'd suggest
def test2(arr)
v = nil
arr.find { |h| v = h[55] } && v
end
even though it doesn't meet your requirement. & in the first is the safe navigation operator, which made its debut in Ruby v2.3. By "cheap" I mean that no extensive calculation is required to determine the value of a key (computing pi to one million digits, for example). See Hash#[].
Suppose
a1 = [{ 9=>'cat', 14=>'dog', 12=>'pig' }, { 9=>'cat', 55=>'dog', 12=>'pig' }]
a2 = [{ 9=>'cat', 14=>'dog', 12=>'pig' }, { 9=>'cat', 12=>'dog', 12=>'pig' }]
then
test1(a1)
#=> 'dog'
test1(a2)
#=> nil
test2(a1)
#=> 'dog'
test2(a2)
#=> nil
As pointed out in a comment, the following is a variant of test1.
def test1(arr)
arr.find(->{{}}) { |h| h[55] }[55]
end
See Enumerable#find, specifically, if no match is found and find has an argument which responds to call (namely, a proc or method), that argument is called and the result is returned by find. (To use a method rather than a proc: def m() {} end; arr.find(method(:m)) { |h| h[55] }[55].)