Method: VagrantCloud::Data::Mutable.attr_mutable

Defined in:
lib/vagrant_cloud/data.rb

.attr_mutable(*args) ⇒ Object

Define attributes which are mutable



187
188
189
190
191
192
193
194
195
196
# File 'lib/vagrant_cloud/data.rb', line 187

def self.attr_mutable(*args)
  sync do
    args.each do |attr|
      if !attr_required.include?(attr.to_sym) && !attr_optional.include?(attr.to_sym)
        raise ArgumentError, "Unknown attribute name provided `#{attr}`"
      end
      define_method("#{attr}=") { |v| dirty[attr.to_sym] = v }
    end
  end
end