Method: Object#tmp
- Defined in:
- lib/mspec/helpers/tmp.rb
#tmp(name, uniquify = true) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mspec/helpers/tmp.rb', line 34 def tmp(name, uniquify=true) Dir.mkdir SPEC_TEMP_DIR unless File.exist? SPEC_TEMP_DIR if uniquify and !name.empty? slash = name.rindex "/" index = slash ? slash + 1 : 0 name.insert index, "#{SPEC_TEMP_UNIQUIFIER.succ!}-" end File.join SPEC_TEMP_DIR, name end |