Class: Stapler::Bundle::SerializedKey

Inherits:
Object
  • Object
show all
Defined in:
lib/stapler/bundle/serialized_key.rb

Class Method Summary collapse

Class Method Details

.to_key(paths) ⇒ Object



11
12
13
14
# File 'lib/stapler/bundle/serialized_key.rb', line 11

def to_key(paths)
  key = Utils.url_encode(paths.map { |a| Utils.groom_path(a) })
  File.join(key, signature(key), @@asset_id)
end

.to_paths(bundle) ⇒ Object



16
17
18
19
20
21
# File 'lib/stapler/bundle/serialized_key.rb', line 16

def to_paths(bundle)
  key, signature = bundle.split(/[\.\/]/, 3)
  url_decode_with_signature(key, signature)
rescue Utils::BadString
  nil
end