Sha256: 84e5bb393ac4d06500da26c321439500222ae8eeee2166fceebe007f71f06984

Contents?: true

Size: 1.68 KB

Versions: 16

Compression:

Stored size: 1.68 KB

Contents

module Vedeu

  module Geometries

    # Validate values given to {Vedeu::Geometries::DSL}.
    #
    # @api private
    #
    module Validator

      include Vedeu::Common

      # @param value [Fixnum] The number of lines/rows.
      # @raise [Vedeu::Error::InvalidSyntax] When the value is nil.
      # @return [TrueClass]
      def validate_height!(value)
        fail Vedeu::Error::InvalidSyntax,
             'No height given.'.freeze if absent?(value)

        true
      end

      # @param value [Symbol] One of :center, :centre, :left,
      #   :none, :right.
      # @raise [Vedeu::Error::InvalidSyntax] When the value is nil.
      # @return [TrueClass]
      def validate_horizontal_alignment!(value)
        fail Vedeu::Error::InvalidSyntax,
             'No horizontal alignment given. Valid values are :center, ' \
             ':centre, :left, :none, :right.'.freeze unless present?(value)

        true
      end

      # @param value [Symbol] One of :bottom, :middle, :none, :top.
      # @raise [Vedeu::Error::InvalidSyntax] When the value is nil.
      # @return [TrueClass]
      def validate_vertical_alignment!(value)
        fail Vedeu::Error::InvalidSyntax,
             'No vertical alignment given. Valid values are :bottom, ' \
             ':middle, :none, :top.'.freeze unless present?(value)

        true
      end

      # @param value [Fixnum] The number of characters/columns.
      # @raise [Vedeu::Error::InvalidSyntax] When the value is nil.
      # @return [TrueClass]
      def validate_width!(value)
        fail Vedeu::Error::InvalidSyntax,
             'No width given.'.freeze if absent?(value)

        true
      end

    end # Validator

  end # Geometries

end # Vedeu

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
vedeu-0.7.4 lib/vedeu/geometries/dsl/validator.rb
vedeu-0.7.3 lib/vedeu/geometries/dsl/validator.rb
vedeu-0.7.2 lib/vedeu/geometries/dsl/validator.rb
vedeu-0.7.1 lib/vedeu/geometries/dsl/validator.rb
vedeu-0.7.0 lib/vedeu/geometries/dsl/validator.rb
vedeu-0.6.71 lib/vedeu/geometries/dsl/validator.rb
vedeu-0.6.70 lib/vedeu/geometries/dsl/validator.rb
vedeu-0.6.69 lib/vedeu/geometries/dsl/validator.rb
vedeu-0.6.68 lib/vedeu/geometries/validator.rb
vedeu-0.6.67 lib/vedeu/geometries/validator.rb
vedeu-0.6.66 lib/vedeu/geometries/validator.rb
vedeu-0.6.65 lib/vedeu/geometries/validator.rb
vedeu-0.6.64 lib/vedeu/geometries/validator.rb
vedeu-0.6.63 lib/vedeu/geometries/validator.rb
vedeu-0.6.62 lib/vedeu/geometries/validator.rb
vedeu-0.6.61 lib/vedeu/geometries/validator.rb