class VagrantCloud::Data::Immutable

Immutable data class. This class adds extra functionality to the Data class like providing attribute methods which can be defined using the ‘attr_required` and `attr_optional` methods. Once an instance is created the data is immutable. For example:

class MyData < Immutable

attr_required :name
attr_optional :version

end

When creating a new instance, a name parameter must be provided, but a version parameter is optional, so both are valid:

instance = MyData.new(name: “testing”, version: “new-version”)

and

instance = MyData.new(name: “testing”)

but only providing the version is invalid:

instance = MyData.new(version: “new-version”) # -> Exception