Class: FancyHash::Types::Array

Inherits:
ActiveModel::Type::Value
  • Object
show all
Defined in:
lib/fancy_hash.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(of: nil) ⇒ Array

Returns a new instance of Array.



78
79
80
81
82
# File 'lib/fancy_hash.rb', line 78

def initialize(of: nil)
  super()

  @of = of
end

Instance Attribute Details

#ofObject (readonly)

Returns the value of attribute of.



76
77
78
# File 'lib/fancy_hash.rb', line 76

def of
  @of
end

Instance Method Details

#serialize(value) ⇒ Object



84
85
86
# File 'lib/fancy_hash.rb', line 84

def serialize(value)
  value&.map { |v| Types.find(of).serialize(v) }
end