Skip to content

Instantly share code, notes, and snippets.

@holmser
Last active March 30, 2016 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holmser/919b51a393d26b3489e6cdcdbbfb8e6b to your computer and use it in GitHub Desktop.
Save holmser/919b51a393d26b3489e6cdcdbbfb8e6b to your computer and use it in GitHub Desktop.
def create_name()
date = Time.now.strftime("%Y%m%d")
serial = 1
name = {"#{@obj_name}-#{date}-#{format('%02d', serial)}#{@obj_ext}"}
while @objects.any?{|key, value| key == name}
serial += 1
name = {"#{@obj_name}-#{date}-#{format('%02d', serial)}#{@obj_ext}"}
end
name
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment