"output" is a serialized OpenStruct.
def title
try(:output).try(:data).try(:title)
end
What would be better? :)
Or simply this:
def title
output.data.title rescue nil
end
Referring to this blog you might find it better to use the &. operator like below for ruby version > 2.3.0;
output&.data&.title
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With