Skip to content

Instantly share code, notes, and snippets.

@perspectivezoom
Created June 18, 2012 21:31
Show Gist options
  • Save perspectivezoom/2950850 to your computer and use it in GitHub Desktop.
Save perspectivezoom/2950850 to your computer and use it in GitHub Desktop.
module Mark_twain
def mark_twain
mark_twain_helper(self, [])
end
def mark_twain_helper(str, accum_ar)
if str.split.length == 1
accum_ar << "Final draft: #{str}."
accum_ar
else
accum_ar << "Draft: #{str}."
reduced_str = str.split[(0..-2)].join(" ")
mark_twain_helper( reduced_str , accum_ar )
end
end
end
class String
include Mark_twain
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment