immutable-struct
immutable-struct copied to clipboard
Create struct-like classes that don't have setters, but have an awesome constructor.
Ruby 3.04: ``` 3.0.4 :001 > RRR = ImmutableStruct.new(:source_type, :text, :score, :data, :error_message) => RRR 3.0.4 :002 > x1 = RRR.new(text: "Hello") => # 3.0.4 :003 > x2 = x1.merge(score:...
Hey👋 I'm using the gem a lot! Would adding defaults with keyword arguments be something worth doing? It shouldn't be hard, I can open a PR if you are interested....
# Problem ```ruby # Example ImmutableStruct Example = ImmutableStruct.new([:name]) Example.new(name: "somestring") # => NoMethodError (undefined method `to_a' for "somestring":String) ``` # Potential solution: Check if we can call `#to_a` on...
# Problem Platform has updated the point release of Ruby in our containers. This means that your dev environment is out of sync with production. # Solution Update `.ruby-version` to...