Class: Aspera::IdGenerator
- Inherits:
-
Object
- Object
- Aspera::IdGenerator
- Defined in:
- lib/aspera/id_generator.rb
Class Method Summary collapse
-
.from_list(*ids) ⇒ String
Generate an ID from a list of object IDs The generated ID is safe as file name In URLs keep only the host name, we assume only one instance on a given host.
Class Method Details
.from_list(*ids) ⇒ String
Generate an ID from a list of object IDs The generated ID is safe as file name In URLs keep only the host name, we assume only one instance on a given host.
17 18 19 20 21 22 23 |
# File 'lib/aspera/id_generator.rb', line 17 def from_list(*ids) safe_char = Environment.instance.safe_filename_character # compact: remove nils id = ids.flatten.compact.map { |i| host_or_text(i) }.join(safe_char) # keep dot for extension only (nicer) return Environment.instance.sanitized_filename(id.gsub('.', safe_char)).downcase end |