module TopDown
Direct including types
Defined in:
auto/top_down.crInstance Method Summary
-
#canvas_td : Array(Array(String))
Canvas is a variable that holds the cell of each string in grid format.
-
#canvas_td=(canvas_td : Array(Array(String)))
Canvas is a variable that holds the cell of each string in grid format.
-
#col_width_td : Array(Int32)
Holds curently max width for every column.
-
#col_width_td=(col_width_td : Array(Int32))
Holds curently max width for every column.
-
#one_column_td : Array(Array(String))
Return canvas with the size of one column.
-
#virtual_column_width_td(col_size : Int32) : Array(Int32)
Calculate each column width for canvas with virtually col item of col_size.
Instance Method Detail
Canvas is a variable that holds the cell of each string in grid format. In @canvas_td, each element in the array is representing a column.
Example:
@canvas_td = [["Rubys", "Crystals", "Emeralds"], ["Sappgires", "a", "b"]]
# It is Top-Down
# Rubys Sappgires
# Crystals a
# Emeralds b
Canvas is a variable that holds the cell of each string in grid format. In @canvas_td, each element in the array is representing a column.
Example:
@canvas_td = [["Rubys", "Crystals", "Emeralds"], ["Sappgires", "a", "b"]]
# It is Top-Down
# Rubys Sappgires
# Crystals a
# Emeralds b
Holds curently max width for every column.
Example:
@canvas_td = [["Rubys", "Crystals", "Emeralds"], ["Sappgires", "a", "b"]]
@col_width_td = [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_td = [["Rubys", "Crystals", "Emeralds"], ["Sappgires", "a", "b"]]
@col_width_td = [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_td and calculate the @col_width_td
Example:
@list = [
"str_1",
"str_30",
"str_200",
"str_4000",
"str_50000",
]
one_column_td # => [["str_1", "str_30", "str_200", "str_4000", "str_50000"]]
Calculate each column width for canvas with virtually col item of col_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_td(3) # => [7, 9]
# Virtual column would be like
# str_1 str_4000
# str_30 str_50000
# str_200
virtual_column_width_td(2) # => [6, 8, 9]
# Virtual column would be like
# str_1 str_200 str_50000
# str_30 str_4000