Sha256: 959a97068861daebb742427be8f15980149159bcd6e96824f103fed96a3f864b

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

module Vedeu

  module Geometry

    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 vertical [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 # Geometry

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.6.45 lib/vedeu/geometry/validator.rb