resource_path.rb 279 B

123456789101112131415161718
  1. class ResourcePath
  2. attr_writer :param
  3. def initialize(path, options = {})
  4. @path = path
  5. @param = options[:param]
  6. end
  7. def param
  8. @param ||= (0...8).map{65.+(rand(25)).chr}.join
  9. end
  10. def to_s
  11. @path.gsub('*', param)
  12. end
  13. end