Sha256: ee896ff701493f955f234297ee3759af2bf113f5b1b0fabe6ef40526902c9569

Contents?: true

Size: 625 Bytes

Versions: 19

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

module Vedeu

  module Coercers

    # Provides the mechanism to convert a value into a
    # {Vedeu::Models::Row}.
    #
    # @api private
    #
    class Row < Vedeu::Coercers::Coercer

      # @return [Vedeu::Models::Row]
      def coerce
        if coerced?
          value

        elsif array?(value)
          klass.new(value.compact)

        elsif value.nil?
          klass.new

        else
          klass.new([value])

        end
      end

      private

      # @return [Class]
      def klass
        Vedeu::Models::Row
      end

    end # Row

  end # Coercers

end # Vedeu

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
vedeu-0.8.32 lib/vedeu/coercers/row.rb
vedeu-0.8.31 lib/vedeu/coercers/row.rb
vedeu-0.8.30 lib/vedeu/coercers/row.rb
vedeu-0.8.29 lib/vedeu/coercers/row.rb
vedeu-0.8.28 lib/vedeu/coercers/row.rb
vedeu-0.8.27 lib/vedeu/coercers/row.rb
vedeu-0.8.26 lib/vedeu/coercers/row.rb
vedeu-0.8.25 lib/vedeu/coercers/row.rb
vedeu-0.8.24 lib/vedeu/coercers/row.rb
vedeu-0.8.23 lib/vedeu/coercers/row.rb
vedeu-0.8.22 lib/vedeu/coercers/row.rb
vedeu-0.8.21 lib/vedeu/coercers/row.rb
vedeu-0.8.20 lib/vedeu/coercers/row.rb
vedeu-0.8.19 lib/vedeu/coercers/row.rb
vedeu-0.8.18 lib/vedeu/coercers/row.rb
vedeu-0.8.17 lib/vedeu/coercers/row.rb
vedeu-0.8.16 lib/vedeu/coercers/row.rb
vedeu-0.8.15 lib/vedeu/coercers/row.rb
vedeu-0.8.14 lib/vedeu/coercers/row.rb