File: mash.rb

package info (click to toggle)
ruby-hashie-forbidden-attributes 0.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 240 kB
  • ctags: 18
  • sloc: ruby: 150; makefile: 3
file content (18 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'hashie/mash'

module Hashie
  class Mash
    alias_method :_respond_to_missing?, :respond_to_missing?
    alias_method :_method_missing, :method_missing

    def respond_to_missing?(method_name, *args)
      return false if method_name == :permitted?
      _respond_to_missing?(method_name, args)
    end

    def method_missing(method_name, *args)
      fail ArgumentError if method_name == :permitted?
      _method_missing(method_name, *args)
    end
  end
end