Sha256: 45532a3775bc60196ca6e7120ee2b6499ebabc059dba1b19bbc1a7ddd9b7fc41

Contents?: true

Size: 736 Bytes

Versions: 6

Compression:

Stored size: 736 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

      # @macro raise_invalid_syntax
      # @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

6 entries across 6 versions & 1 rubygems

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