Class: Decidim::Attributes::Hash

Inherits:
Array
  • Object
show all
Defined in:
decidim-core/lib/decidim/attributes/hash.rb

Overview

Custom attributes value to represent a Hash.

Instance Attribute Summary collapse

Attributes inherited from Array

#default, #value_type

Instance Method Summary collapse

Methods inherited from Array

#cast, #validate_nested?

Constructor Details

#initialize(key_type: ::Symbol, value_type: ::Object, default: {}) ⇒ Hash

Returns a new instance of Hash.



9
10
11
12
13
# File 'decidim-core/lib/decidim/attributes/hash.rb', line 9

def initialize(key_type: ::Symbol, value_type: ::Object, default: {})
  @key_type = key_type
  @value_type = value_type
  @default = default
end

Instance Attribute Details

#key_typeObject (readonly)

Returns the value of attribute key_type.



7
8
9
# File 'decidim-core/lib/decidim/attributes/hash.rb', line 7

def key_type
  @key_type
end

Instance Method Details

#typeObject

:nodoc:



15
16
17
# File 'decidim-core/lib/decidim/attributes/hash.rb', line 15

def type # :nodoc:
  :hash
end