Class: GandiV5::Data::Converter::ArrayOf
- Inherits:
-
Object
- Object
- GandiV5::Data::Converter::ArrayOf
- Defined in:
- lib/gandi_v5/data/converter/array_of.rb
Overview
Used for applying the same converter to each item in an array.
Instance Method Summary collapse
- #from_gandi(value) ⇒ Object
-
#initialize(converter) ⇒ ArrayOf
constructor
A new instance of ArrayOf.
- #to_gandi(value) ⇒ Array<Object>
Constructor Details
#initialize(converter) ⇒ ArrayOf
Returns a new instance of ArrayOf.
9 10 11 |
# File 'lib/gandi_v5/data/converter/array_of.rb', line 9 def initialize(converter) @converter = converter end |
Instance Method Details
#from_gandi(value) ⇒ Object
23 24 25 26 27 |
# File 'lib/gandi_v5/data/converter/array_of.rb', line 23 def from_gandi(value) return nil if value.nil? value.map { |item| converter.from_gandi(item) } end |
#to_gandi(value) ⇒ Array<Object>
15 16 17 18 19 |
# File 'lib/gandi_v5/data/converter/array_of.rb', line 15 def to_gandi(value) return nil if value.nil? value.map { |item| converter.to_gandi(item) } end |