IRuby.display IRuby.table([1,2,[],3])
IRuby.display IRuby.table([1,2,[1,2,3],[2,3]])
IRuby.display IRuby.table({a:1,b:2,c:3})
IRuby.display IRuby.table([[11,12,13,14],[21,22,23],'not an Array',[31,32,33,34]])
IRuby.display IRuby.table({a:[11,12,13,14],b:[21,22,23],c:[31,32,33,34]})
IRuby.display IRuby.table([{a:1,b:2,c:3},'not an Array',{a:2,b:3,c:4,e:5}])
IRuby.display IRuby.table([{a:1,b:2,c:3, 0 => 0},{a:2,b:3,c:4,d:5},{0=>:x,1=>:y},[:a,:b,:c]])
1 |
2 |
3 |
1 | ||
2 | ||
1 | 2 | 3 |
2 | 3 |
a | b | c |
---|---|---|
1 | 2 | 3 |
11 | 12 | 13 | 14 |
21 | 22 | 23 | |
not an Array | |||
31 | 32 | 33 | 34 |
a | b | c |
---|---|---|
11 | 21 | 31 |
12 | 22 | 32 |
13 | 23 | 33 |
14 | 34 |
a | b | c | e |
---|---|---|---|
1 | 2 | 3 | |
not an Array | |||
2 | 3 | 4 | 5 |
a | b | c | 0 | d | 1 | 2 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 0 | |||
2 | 3 | 4 | 5 | |||
x | y | |||||
a | b | c |
IRuby.table (1..1000).map {|i| (1..1000).map {|j| i * j } }
1 | 2 | 3 | 4 | 5 | 6 | 7 | … | 993 | 994 | 995 | 996 | 997 | 998 | 999 |
2 | 4 | 6 | 8 | 10 | 12 | 14 | 1986 | 1988 | 1990 | 1992 | 1994 | 1996 | 1998 | |
3 | 6 | 9 | 12 | 15 | 18 | 21 | 2979 | 2982 | 2985 | 2988 | 2991 | 2994 | 2997 | |
4 | 8 | 12 | 16 | 20 | 24 | 28 | 3972 | 3976 | 3980 | 3984 | 3988 | 3992 | 3996 | |
5 | 10 | 15 | 20 | 25 | 30 | 35 | 4965 | 4970 | 4975 | 4980 | 4985 | 4990 | 4995 | |
6 | 12 | 18 | 24 | 30 | 36 | 42 | 5958 | 5964 | 5970 | 5976 | 5982 | 5988 | 5994 | |
7 | 14 | 21 | 28 | 35 | 42 | 49 | 6951 | 6958 | 6965 | 6972 | 6979 | 6986 | 6993 | |
⋮ | ⋱ | ⋮ | ||||||||||||
993 | 1986 | 2979 | 3972 | 4965 | 5958 | 6951 | … | 986049 | 987042 | 988035 | 989028 | 990021 | 991014 | 992007 |
994 | 1988 | 2982 | 3976 | 4970 | 5964 | 6958 | 987042 | 988036 | 989030 | 990024 | 991018 | 992012 | 993006 | |
995 | 1990 | 2985 | 3980 | 4975 | 5970 | 6965 | 988035 | 989030 | 990025 | 991020 | 992015 | 993010 | 994005 | |
996 | 1992 | 2988 | 3984 | 4980 | 5976 | 6972 | 989028 | 990024 | 991020 | 992016 | 993012 | 994008 | 995004 | |
997 | 1994 | 2991 | 3988 | 4985 | 5982 | 6979 | 990021 | 991018 | 992015 | 993012 | 994009 | 995006 | 996003 | |
998 | 1996 | 2994 | 3992 | 4990 | 5988 | 6986 | 991014 | 992012 | 993010 | 994008 | 995006 | 996004 | 997002 | |
999 | 1998 | 2997 | 3996 | 4995 | 5994 | 6993 | 992007 | 993006 | 994005 | 995004 | 996003 | 997002 | 998001 |
IRuby.table Hash[(1..1000).map {|i| [i, (1..1000).map {|j| i * j }] }]
1 | 2 | 3 | 4 | 5 | 6 | 7 | … | 993 | 994 | 995 | 996 | 997 | 998 | 999 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 | … | 993 | 994 | 995 | 996 | 997 | 998 | 999 |
2 | 4 | 6 | 8 | 10 | 12 | 14 | 1986 | 1988 | 1990 | 1992 | 1994 | 1996 | 1998 | |
3 | 6 | 9 | 12 | 15 | 18 | 21 | 2979 | 2982 | 2985 | 2988 | 2991 | 2994 | 2997 | |
4 | 8 | 12 | 16 | 20 | 24 | 28 | 3972 | 3976 | 3980 | 3984 | 3988 | 3992 | 3996 | |
5 | 10 | 15 | 20 | 25 | 30 | 35 | 4965 | 4970 | 4975 | 4980 | 4985 | 4990 | 4995 | |
6 | 12 | 18 | 24 | 30 | 36 | 42 | 5958 | 5964 | 5970 | 5976 | 5982 | 5988 | 5994 | |
7 | 14 | 21 | 28 | 35 | 42 | 49 | 6951 | 6958 | 6965 | 6972 | 6979 | 6986 | 6993 | |
⋮ | ⋱ | ⋮ | ||||||||||||
993 | 1986 | 2979 | 3972 | 4965 | 5958 | 6951 | … | 986049 | 987042 | 988035 | 989028 | 990021 | 991014 | 992007 |
994 | 1988 | 2982 | 3976 | 4970 | 5964 | 6958 | 987042 | 988036 | 989030 | 990024 | 991018 | 992012 | 993006 | |
995 | 1990 | 2985 | 3980 | 4975 | 5970 | 6965 | 988035 | 989030 | 990025 | 991020 | 992015 | 993010 | 994005 | |
996 | 1992 | 2988 | 3984 | 4980 | 5976 | 6972 | 989028 | 990024 | 991020 | 992016 | 993012 | 994008 | 995004 | |
997 | 1994 | 2991 | 3988 | 4985 | 5982 | 6979 | 990021 | 991018 | 992015 | 993012 | 994009 | 995006 | 996003 | |
998 | 1996 | 2994 | 3992 | 4990 | 5988 | 6986 | 991014 | 992012 | 993010 | 994008 | 995006 | 996004 | 997002 | |
999 | 1998 | 2997 | 3996 | 4995 | 5994 | 6993 | 992007 | 993006 | 994005 | 995004 | 996003 | 997002 | 998001 |
IRuby.display IRuby.table [[1,2],[3,4]], header: true
IRuby.display IRuby.table [[1,2],[3,4]], header: false
IRuby.display IRuby.table [[1,2],[3,4]]
IRuby.display IRuby.table [{a:1,b:2},{a:3,b:4}], header: true
IRuby.display IRuby.table [{a:1,b:2},{a:3,b:4}], header: false
IRuby.display IRuby.table [{a:1,b:2},{a:3,b:4}]
IRuby.display IRuby.table({a:[1,3],b:[2,4]}, header: true)
IRuby.display IRuby.table({a:[1,3],b:[2,4]}, header: false)
IRuby.display IRuby.table({a:[1,3],b:[2,4]})
0 | 1 |
---|---|
1 | 2 |
3 | 4 |
1 | 2 |
3 | 4 |
1 | 2 |
3 | 4 |
a | b |
---|---|
1 | 2 |
3 | 4 |
1 | 2 |
3 | 4 |
a | b |
---|---|
1 | 2 |
3 | 4 |
a | b |
---|---|
1 | 2 |
3 | 4 |
1 | 2 |
3 | 4 |
a | b |
---|---|
1 | 2 |
3 | 4 |
IRuby.display IRuby.table({a:1,b:2,c:[3,4]})
a | b | c |
---|---|---|
1 | 2 | 3 |
4 |
class Red < String
def to_html
"<span style='color:red'>#{self}</span>"
end
end
IRuby.display IRuby.table({Red.new("a") => 1, b:2, c: [3, Red.new("4")]})
a | b | c |
---|---|---|
1 | 2 | 3 |
4 |