Class: Wings::NestedResourceArrayValue
- Inherits:
-
Valkyrie::ValueMapper
- Object
- Valkyrie::ValueMapper
- Wings::NestedResourceArrayValue
- Defined in:
- lib/wings/converter_value_mapper.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.handles?(value) ⇒ Boolean
198 199 200 |
# File 'lib/wings/converter_value_mapper.rb', line 198 def self.handles?(value) value.last.is_a?(Array) && value.last.any? { |x| x.is_a? Dry::Struct } end |
Instance Method Details
#result ⇒ Object
202 203 204 |
# File 'lib/wings/converter_value_mapper.rb', line 202 def result ["#{value.first}_attributes".to_sym, values] end |
#values ⇒ Object
206 207 208 209 210 |
# File 'lib/wings/converter_value_mapper.rb', line 206 def values value.last.map do |val| calling_mapper.for([value.first, val]).result end.flat_map(&:last) end |