Ruby Examples

This commit is contained in:
2026-01-15 14:01:21 +09:00
commit cf3d7d3296
76 changed files with 1191 additions and 0 deletions

19
level6/59.rb Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
snake_case → camelCase 변환
=end
str = "hello_world"
puts str.split("_")
.map { |s| s.capitalize}
.join
# ---
x = str.gsub(/_[a-z]/) do |s|
s.to_s.delete("_").upcase
end
puts x