Module: Extras::Hash::ClassMethods

Defined in:
lib/extras/hash.rb

Instance Method Summary collapse

Instance Method Details

#allowedObject


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/extras/hash.rb', line 10

def allowed
  if RUBY_VERSION < "2.4"
    @allowed ||= begin
      {
        :keys => [],
        :vals => [::NilClass, ::Hash, ::TrueClass, \
          ::FalseClass, ::Regexp, ::Array, ::Set, ::Fixnum,
          ::Bignum, ::Float]
      }
    end
  else
    @allowed ||= begin
      {
        :keys => [],
        :vals => [::NilClass, ::Hash, ::TrueClass, \
          ::FalseClass, ::Regexp,  ::Array, ::Set, ::Integer,
          ::Float]
      }
    end
  end
end