Ozimodo Madness
Posted by hardwarehank, Mon Jul 10 23:39:59 UTC 2006
Well, defunkt and I were working on the oz script, and we found a little bug, which he fixed like this (I thought this was pretty slick)
irb(main):058:0> host = "modzer0.cs.uaf.edu" => "modzer0.cs.uaf.edu" irb(main):059:0> domain = host =~ /([^\/]+)\/(.+)/ ? "#{$1}#{':80'}/#{$2}" : "#{host}#{':80'}" => "modzer0.cs.uaf.edu:80" irb(main):060:0> host = "modzer0.cs.uaf.edu/hank-typo" => "modzer0.cs.uaf.edu/hank-typo" irb(main):061:0> domain = host =~ /([^\/]+)\/(.+)/ ? "#{$1}#{':80'}/#{$2}" : "#{host}#{':80'}" => "modzer0.cs.uaf.edu:80/hank-typo"
I need to make sure to brush up on my RegExp Skillz before I get into the real world.

Blog Posts
July 10, 2006 @ 11:54 PM
`=> true`
`>> uri = URI.parse 'http://modzer0.cs.uaf.edu/hank-typo'`
`=> #<uri::generic:0x1ae4b4>`
`>> "#{uri.host}:#{uri.port}:#{uri.path}"`
`=> "modzer0.cs.uaf.edu:80:/hank-typo"`
Not sure if that's easier or not. Regexps for life.