Sha256: ae02e603bad07c834bce67c78d7828f7d2596d245274938103e7adb1c6f6a613

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 Bytes

Contents

# frozen_string_literal: true

module Vedeu

  module Coercers

    # Provides the mechanism to validate a horizontal alignment value.
    #
    # @api private
    #
    class HorizontalAlignment < Vedeu::Coercers::Alignment

      # @raise (see Vedeu::Coercers::Alignment#validate)
      # @return (see Vedeu::Coercers::Alignment#validate)
      def validate
        return coerce if valid_horizontal?

        fail Vedeu::Error::InvalidSyntax,
             'Missing or invalid horizontal alignment value. ' \
             "Valid values are: #{to_sentence}"
      end

      private

      # @return [String]
      def to_sentence
        Vedeu::Sentence.construct(horizontal_values)
      end

    end # HorizontalAlignment

  end # Coercers

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.8.5 lib/vedeu/coercers/horizontal_alignment.rb