I Have a struct - let's say it looks like this:
class MyClass::Subclass < Struct.new(:model1, :model2)
def method1
end
def method2
if model1.active?
end
end
end
This is how I currently have a subclass setup. I am now at a point where I have to pass in a one-time options.
My thinking is that there must be something similar to what you can do in methods like:
class MyClass::Subclass < Struct.new(:model1, :model2, options = {})
def method1
if options["need_this"]
end
end
end
I keep on getting errors:
TypeError: {} is not a symbol
Is there something like options = {}
that I can use in Structs? Sorry this may seem like a newb question but Ruby is not my main language.