darashi on Nostr: /run rb def rotate(c) c.sub(/ー/, "|") end def cross(str) s = str.chars l = ...
/run rb
def rotate(c)
c.sub(/ー/, "|")
end
def cross(str)
s = str.chars
l = s.length
pad = " " * (l - 1)
s[...-1].each do |c|
puts pad + rotate(c)
end
puts (s + s[...-1].reverse).join
s[...-1].reverse.each do |c|
puts pad + rotate(c)
end
end
cross "ハロウィーン🎃"
def rotate(c)
c.sub(/ー/, "|")
end
def cross(str)
s = str.chars
l = s.length
pad = " " * (l - 1)
s[...-1].each do |c|
puts pad + rotate(c)
end
puts (s + s[...-1].reverse).join
s[...-1].reverse.each do |c|
puts pad + rotate(c)
end
end
cross "ハロウィーン🎃"