Sha256: 0b3830e23b73c89c31daca0421b060b4197e0c78b47c16220c04c058f9575151
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
module Vedeu module Geometry # The subclasses of this class, HorizontalAlignment and # VerticalAlignment provide the mechanism to align an interface or # view horizontally or vertically within the available terminal # space. # # @see Vedeu::Geometry::HorizontalAlignment # @see Vedeu::Geometry::VerticalAlignment # class Alignment # @param (see #initialize) # @return (see #align) def self.align(value = nil) new(value).align end # @param value [NilClass|Symbol] # @return [Vedeu::Geometry::Alignment] def initialize(value = nil) @value = value end # @raise [Vedeu::Error::NotImplemented] Subclasses of this class # must implement this method. def align fail Vedeu::Error::NotImplemented, 'Subclasses implement this.'.freeze end private # @return [Boolean] def none? @value.nil? || !(@value.is_a?(Symbol)) end # @return [Boolean] def valid? values.include?(value) end # @return [Symbol] def value @_value ||= if none? :none elsif @value == :center :centre else @value.to_sym end end # @return [Array<Symbol>] def values [ :bottom, :centre, :left, :middle, :none, :right, :top, ] end end # Alignment end # Geometry end # Vedeu
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.6.36 | lib/vedeu/geometry/alignment.rb |