Skip to content

Instantly share code, notes, and snippets.

@gotmayonase
gotmayonase / lochness.rb
Created March 7, 2012 21:26 — forked from marcinbunsch/lochness.rb
Loch Ness Monster Case implementation in Ruby
class String
def loch_ness_monster_case
self.split('::').collect do |section|
section.gsub(/([^\/])([A-Z])/, '\1_\2').downcase.split(/_/).collect { |part|
chars = part.split('')
half = chars.length/2
chars[half].upcase!
chars[half - 1].upcase!
chars.join('')