module LeftRight
Direct including types
Defined in:
auto/left_right.crInstance Method Summary
-
#canvas_lr : Array(Array(String))
Canvas is a variable that holds the cell of each string in grid format.
-
#canvas_lr=(canvas_lr : Array(Array(String)))
Canvas is a variable that holds the cell of each string in grid format.
-
#col_width_lr : Array(Int32)
Holds curently max width for every column.
-
#col_width_lr=(col_width_lr : Array(Int32))
Holds curently max width for every column.
-
#one_column_lr : Array(Array(String))
Return canvas with the size of one column.
-
#virtual_column_width_lr(row_size : Int32) : Array(Int32)
Calculate each column width for canvas with virtually row item of row_size.
Instance Method Detail
Canvas is a variable that holds the cell of each string in grid format. In @canvas_ld, each element in the array is representing a row.
Example:
@canvas_lr = [["Rubys", "Crystals"], ["Emeralds", "Sapphires"], ["a", "b"]]
# It is Left-Right
# Rubys Crystals
# Emeralds Sapphires
# a b
Canvas is a variable that holds the cell of each string in grid format. In @canvas_ld, each element in the array is representing a row.
Example:
@canvas_lr = [["Rubys", "Crystals"], ["Emeralds", "Sapphires"], ["a", "b"]]
# It is Left-Right
# Rubys Crystals
# Emeralds Sapphires
# a b
Holds curently max width for every column.
Example:
@canvas_lr = [["Rubys", "Crystals"], ["Emeralds", "Sapphires"], ["a", "b"]]
@col_width_lr = [8, 9]
# => 1st column width is 6 char
# => 2nd column width is 7 char
# => 3rd column width is 9 char
Holds curently max width for every column.
Example:
@canvas_lr = [["Rubys", "Crystals"], ["Emeralds", "Sapphires"], ["a", "b"]]
@col_width_lr = [8, 9]
# => 1st column width is 6 char
# => 2nd column width is 7 char
# => 3rd column width is 9 char
Return canvas with the size of one column. Its set @canvas_lr and calculate the @col_width_lr
Example:
@list = [
"str_1",
"str_30",
"str_200",
"str_4000",
"str_50000",
]
one_column_lr # => [["str_1"], ["str_30"], ["str_200"], ["str_4000"], ["str_50000"]]
Calculate each column width for canvas with virtually row item of row_size.
Returning the width of every column in type Array(Int32)
Example:
@list = [
"str_1",
"str_30",
"str_200",
"str_4000",
"str_50000",
]
virtual_column_width_lr(3) # => [8, 9, 7]
# Virtual column would be like
# str_1 str_30 str_200
# str_4000 str_50000
virtual_column_width_lr(2) # => [9, 8]
# Virtual column would be like
# str_1 str_30
# str_200 str_4000
# str_50000