class TTY::Table::Orientation
A class representing table orientation
@api private
A class representing table orientation
A class representing table orientation
Attributes
name[R]
The name for the orientation
@api public
Public Class Methods
coerce(name)
click to toggle source
Coerce the name argument into an orientation
@param [Symbol] name
@api public
# File lib/tty/table/orientation.rb, line 29 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 raise InvalidOrientationError, "orientation must be one of :horizontal, :vertical" end end
new(name)
click to toggle source
Initialize an Orientation
@api public
# File lib/tty/table/orientation.rb, line 20 def initialize(name) @name = name end
Public Instance Methods
horizontal?()
click to toggle source
Check if orientation is horizontal
@return [Boolean]
@api public
# File lib/tty/table/orientation.rb, line 55 def horizontal? name == :horizontal end
vertical?()
click to toggle source
Check if orientation is vertical
@return [Boolean]
@api public
# File lib/tty/table/orientation.rb, line 46 def vertical? name == :vertical end