Module: Hashie::Extensions::Structure::ClassMethods

Defined in:
lib/hashie/extensions/structure.rb

Instance Method Summary collapse

Instance Method Details

#key(key, options = {}) ⇒ Object


31
32
33
34
35
36
37
38
39
# File 'lib/hashie/extensions/structure.rb', line 31

def key(key, options = {})
  (@permitted_keys ||= []) << key

  if options[:default]
    (@default_values ||= {})[key] = options.delete(:default)
  end

  permitted_keys
end

#permitted_keysObject


41
42
43
# File 'lib/hashie/extensions/structure.rb', line 41

def permitted_keys
  @permitted_keys
end