I'm trying to create a class Song that takes in two inputs, song and artist, and creates objects that are arrays i.e. [song, artist]. When I run this code, my assertion that my object is an array fails. How can I correctly write an initialize method that takes in two inputs and creates an array object?
My code:
class Song
def initialize(song, artist)
@piece = [song, artist]
end
end
hello = Song.new("hello", "goodbye")
def assert
raise "Assertion failed!" unless yield
end
assert { hello.kind_of?(Array) }