module Hashie::Extensions::Mash::SafeAssignment
Rejects assignments that would shadow existing Mash methods.
@example
klass = Class.new(Hashie::Mash) do include Hashie::Extensions::Mash::SafeAssignment end mash = klass.new expect { mash[:size] = 2 }.to raise_error(ArgumentError, /clashes/) mash.empty? # => true
Public Instance Methods
[]=(*args)
click to toggle source
@example
klass = Class.new(Hashie::Mash) do include Hashie::Extensions::Mash::SafeAssignment end mash = klass.new mash[:name] = 'Ada' mash.name # => 'Ada' expect { mash[:size] = 2 }.to raise_error(ArgumentError, /clashes/)
# File lib/hashie/extensions/mash/safe_assignment.rb, line 30 def []=(*args) custom_writer(*args) end