summaryrefslogtreecommitdiff
path: root/lib/hashie/extensions/mash/safe_assignment.rb
blob: 4fa58c775a144cd34e582f58805fe9e3bc9da354 (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.to_sym)

          self[name] = value
        end
      end
    end
  end
end