Sha256: 8361b6afa0e502b3a0aab13029dc122a67f472bcd9aca0fb927057ce5a555d9d
Contents?: true
Size: 1.13 KB
Versions: 9
Compression:
Stored size: 1.13 KB
Contents
# encoding: utf-8 module TTY class Table # A class representing table orientation # # @api private class Orientation # The name for the orientation # # @api public attr_reader :name # Initialize an Orientation # # @api public def initialize(name) @name = name end # Coerce the name argument into an orientation # # @param [Symbol] name # # @api public def self.coerce(name) case name.to_s when /h|horiz(ontal)?/i Horizontal.new :horizontal when /v|ert(ical)?/i Vertical.new :vertical else fail InvalidOrientationError, 'orientation must be one of :horizontal, :vertical' end end # Check if orientation is vertical # # @return [Boolean] # # @api public def vertical? name == :vertical end # Check if orientation is horizontal # # @return [Boolean] # # @api public def horizontal? name == :horizontal end end # Orientation end # Table end # TTY
Version data entries
9 entries across 9 versions & 2 rubygems