Skip to content

Instantly share code, notes, and snippets.

@dblooman
Last active February 16, 2016 15:18
Show Gist options
  • Save dblooman/c65e9a58692c9987b151 to your computer and use it in GitHub Desktop.
Save dblooman/c65e9a58692c9987b151 to your computer and use it in GitHub Desktop.
def class_name(names)
names.tr!("_", " ")
items = names.split("/")
items.map { |i| i.split.map(&:capitalize).join("") }.join("::")
end
puts class_name "upload/creator_details"
# -> Upload::CreatorDetails
puts class_name "upload/base"
# -> Upload::Base
puts class_name "index"
# -> Index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment