# coding: UTF-8
def sudden_death_generator(_str)
# 文字列長を生成する。length では半角・全角が1字になるのでバイト長で判断する
length_multibyte_strings = (_str.bytesize / 2) + 1 # +1は文字の前後の空白分
# 文字列を生成する
sudden_death_str = <<EOS
_#{"人" * length_multibyte_strings}_
> #{_str} <
 ̄#{"Y^" * (length_multibyte_strings - 1)}Y ̄
EOS
# 突然の死を表示
puts sudden_death_str
# 突然の死をクリップボードにコピー(Mac)
system "echo \"#{sudden_death_str.chomp}\" | pbcopy "
end
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00