{"id":295,"date":"2009-10-15T23:19:25","date_gmt":"2009-10-15T14:19:25","guid":{"rendered":"http:\/\/ani2life.com\/wp\/?p=295"},"modified":"2009-10-15T23:19:25","modified_gmt":"2009-10-15T14:19:25","slug":"%ec%b9%b4%eb%a9%9c%ec%bc%80%ec%9d%b4%ec%8a%a4%eb%a5%bc-%ec%96%b8%eb%8d%94%eb%b0%94%eb%a1%9c-%eb%b3%80%ed%99%98%ed%95%98%eb%8a%94-%ec%8a%a4%ed%81%ac%eb%a6%bd%ed%8a%b8","status":"publish","type":"post","link":"https:\/\/ani2life.com\/wp\/?p=295","title":{"rendered":"\uce74\uba5c\ucf00\uc774\uc2a4\ub97c \uc5b8\ub354\ubc14\ub85c \ubcc0\ud658\ud558\ub294 \uc2a4\ud06c\ub9bd\ud2b8"},"content":{"rendered":"<p>\uc18c\uc2a4\ud30c\uc77c\ub0b4\uc758 \uce74\uba5c\ucf00\uc774\uc2a4\ub97c \uc5b8\ub354\ubc14\ub85c \ubcc0\ud658\ud558\uc5ec \ub2e4\ub978 \ud30c\uc77c\ub85c \uc800\uc7a5\ud574\uc8fc\ub294 ruby \uc2a4\ud06c\ub9bd\ud2b8 \uc785\ub2c8\ub2e4.<\/p>\n<p>\uc5d0) helloWorld =&gt; hello_world<\/p>\n<pre lang=\"ruby\">### camel2under.rb ###\r\n\r\nif ARGV.empty?\r\n    puts '\uc0ac\uc6a9\ubc95:'\r\n    puts \"#{$0} \uc18c\uc2a4\ud30c\uc77c\uacbd\ub85c [\ubcc0\ud658\ub41c\ud30c\uc77c\uacbd\ub85c]\";\r\n    exit\r\nend\r\n\r\nsource_file = ARGV[0];\r\ntarget_file = ARGV[1] ? ARGV[1] : \"#{source_file}.convert\";\r\n\r\nftarget = File.open(target_file, \"w\")\r\n\r\nFile.open(source_file).each { |line|\r\n    convert_line = line\r\n\r\n    line.scan(\/[A-Z]?[a-z](?:[a-z0-9])*(?:[A-Z][a-z0-9]+)+\/) { |match_str|\r\n        # \ub300\ubb38\uc790\ub85c \uc2dc\uc791\ud558\uba74\r\n        break if match_str.match(\/^[A-Z]\/)\r\n\r\n        replace_str = match_str.gsub(\/([a-z0-9])([A-Z])\/, '\\1_\\2').downcase\r\n\r\n        convert_line = convert_line.gsub(match_str, replace_str)\r\n    }\r\n\r\n    if ( line != convert_line )\r\n        puts '\u250f' + line.gsub(\/^ +\/, '')\r\n        puts '\u2517' + convert_line.gsub(\/^ +\/, '')\r\n    end\r\n\r\n    ftarget.puts convert_line\r\n}\r\n\r\nftarget.close\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\uc18c\uc2a4\ud30c\uc77c\ub0b4\uc758 \uce74\uba5c\ucf00\uc774\uc2a4\ub97c \uc5b8\ub354\ubc14\ub85c \ubcc0\ud658\ud558\uc5ec \ub2e4\ub978 \ud30c\uc77c\ub85c \uc800\uc7a5\ud574\uc8fc\ub294 ruby \uc2a4\ud06c\ub9bd\ud2b8 \uc785\ub2c8\ub2e4. \uc5d0) helloWorld =&gt; hello_world ### camel2under.rb ### if ARGV.empty? puts &#8216;\uc0ac\uc6a9\ubc95:&#8217; puts &#8220;#{$0} \uc18c\uc2a4\ud30c\uc77c\uacbd\ub85c [\ubcc0\ud658\ub41c\ud30c\uc77c\uacbd\ub85c]&#8221;; exit end source_file = ARGV[0]; target_file = ARGV[1] ? ARGV[1] : &#8220;#{source_file}.convert&#8221;; ftarget = File.open(target_file, &#8220;w&#8221;) File.open(source_file).each { |line| convert_line = line line.scan(\/[A-Z]?[a-z](?:[a-z0-9])*(?:[A-Z][a-z0-9]+)+\/) { |match_str| # \ub300\ubb38\uc790\ub85c \uc2dc\uc791\ud558\uba74 break if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[7],"tags":[121,120,122,118,119,117,116],"_links":{"self":[{"href":"https:\/\/ani2life.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/295"}],"collection":[{"href":"https:\/\/ani2life.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ani2life.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ani2life.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ani2life.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=295"}],"version-history":[{"count":8,"href":"https:\/\/ani2life.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":303,"href":"https:\/\/ani2life.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/295\/revisions\/303"}],"wp:attachment":[{"href":"https:\/\/ani2life.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ani2life.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ani2life.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}