Your variable (file_payload) contain a Hash. You should access the list of the file by asking the key directly:
list_of_files = loaded_file["filename"]
If you need to see the content, just add a line with puts list_of_files.inspect. You can add the couple puts + inspect method to see how your objects are built.
I see you use a splat operator (*) in the arguments of your constructor.
A splat operator is generally used with other positional arguments to tell Ruby we can have 0 to n extra arguments to catch in an Array. I’ve never see a splat operator used alone as you do.
I’m not sure it’s your use-case.
You should use positional argument in your constructor (without splat):
def initialize(fn)
@fn = fn
end
And you can pass now the Array when initialize the class:
MyClass.new(list_of_files)
If you really want to use a splat operator in the argument of your constructor, you have to explode the array while passed to the new method: