In Ruby, struct
is used to create a data structure with named members. However, the code you provided is already written in the form of a class, not a struct. If you want to convert the Series
class into a struct, you can do it like this:
main.rb150 chars8 lines
This will define a Series
struct with a single member string
and a slices
method.
gistlibby LogSnag