Sha256: d82b67e8ed76a91ccec861658117092f1588c898509980722ce1916029c7b394
Contents?: true
Size: 879 Bytes
Versions: 19
Compression:
Stored size: 879 Bytes
Contents
# frozen_string_literal: true module Vedeu module Coercers # Provides the mechanism to convert a value into a # {Vedeu::Models::Page}. # # @api private # class Page < Vedeu::Coercers::Coercer # @macro raise_fatal # @return [Vedeu::Models::Page] def coerce if coerced? value elsif value.is_a?(Vedeu::Models::Row) klass.new([value]) elsif array?(value) && value.empty? klass.new([Vedeu::Models::Row.coerce(value)]) elsif array?(value) || value.is_a?(Vedeu::Buffers::View) values = value.map { |v| Vedeu::Models::Row.coerce(v) } klass.new(values) else incoercible! end end private # @return [Class] def klass Vedeu::Models::Page end end # Page end # Coercers end # Vedeu
Version data entries
19 entries across 19 versions & 1 rubygems