summaryrefslogtreecommitdiff
path: root/lib/hashie/extensions/mash/safe_assignment.rb
blob: 2afedc5e3ab68677b4b04108da1575038193eda1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module Hashie
  module Extensions
    module Mash
      module SafeAssignment
        def assign_property(name, value)
          fail ArgumentError, "The property #{name} clashes with an existing method." if methods.include?(name)

          self[name] = value
        end
      end
    end
  end
end