Sha256: 29c180abc760922e63f95332144b2a8caa0718e0bfb4ede71e7f7b575beb10df
Contents?: true
Size: 889 Bytes
Versions: 3
Compression:
Stored size: 889 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 value.is_a?(Array) && value.empty? klass.new([Vedeu::Models::Row.coerce(value)]) elsif value.is_a?(Array) || 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.8.13 | lib/vedeu/coercers/page.rb |
vedeu-0.8.12 | lib/vedeu/coercers/page.rb |
vedeu-0.8.10 | lib/vedeu/coercers/page.rb |