Module: Hashie::Extensions::Mash::SafeAssignment

Defined in:
lib/hashie/extensions/mash/safe_assignment.rb

Instance Method Summary collapse

Instance Method Details

#[]=(*args) ⇒ Object


12
13
14
# File 'lib/hashie/extensions/mash/safe_assignment.rb', line 12

def []=(*args)
  custom_writer(*args)
end

#custom_writer(key, *args) ⇒ Object

:nodoc:


5
6
7
8
9
10
# File 'lib/hashie/extensions/mash/safe_assignment.rb', line 5

def custom_writer(key, *args) #:nodoc:
  if !key?(key) && respond_to?(key, true)
    raise ArgumentError, "The property #{key} clashes with an existing method."
  end
  super
end