Sha256: 6ad96354924f89edef4ad9593b8b7827bf59233e8311cf819c490cc25f4de597
Contents?: true
Size: 662 Bytes
Versions: 1
Compression:
Stored size: 662 Bytes
Contents
module PushType class MatrixField < PushType::FieldType options json_primitive: :array, template: 'matrix' def initialize(*args, &block) super structure_class.class_eval(&block) if block end def value return if json_value.blank? rows end def fields @fields ||= structure_class.new.fields end def rows Array(json_value).map do |h| structure_class.new(field_store: h) end end def structure @structure ||= structure_class.new end private def structure_class @structure_class ||= PushType::Structure.clone end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
push_type_core-0.6.0.beta.2 | app/fields/push_type/matrix_field.rb |