Sha256: ae0f1dda77ce3a30dde3a38a6703a0bf32b0ee8094ab5e7d7adb67efb606579c

Contents?: true

Size: 724 Bytes

Versions: 6

Compression:

Stored size: 724 Bytes

Contents

# frozen_string_literal: true

module Vedeu

  module Coercers

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

      # @macro raise_invalid_syntax
      # @return (see Vedeu::Coercers::Alignment#validate)
      def validate
        return coerce if valid_vertical?

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

      private

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

    end # VerticalAlignment

  end # Coercers

end # Vedeu

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.8.12 lib/vedeu/coercers/vertical_alignment.rb
vedeu-0.8.10 lib/vedeu/coercers/vertical_alignment.rb
vedeu-0.8.9 lib/vedeu/coercers/vertical_alignment.rb
vedeu-0.8.8 lib/vedeu/coercers/vertical_alignment.rb
vedeu-0.8.7 lib/vedeu/coercers/vertical_alignment.rb
vedeu-0.8.6 lib/vedeu/coercers/vertical_alignment.rb