module Shrine::Plugins::PrettyLocation::InstanceMethods

  1. lib/shrine/plugins/pretty_location.rb

Methods

Public Instance

  1. generate_location
  2. pretty_location

Public Instance methods

generate_location(io, **options)
[show source]
   # File lib/shrine/plugins/pretty_location.rb
13 def generate_location(io, **options)
14   pretty_location(io, **options)
15 end
pretty_location(io, name: nil, record: nil, version: nil, derivative: nil, identifier: nil, metadata: {}, **)
[show source]
   # File lib/shrine/plugins/pretty_location.rb
17 def pretty_location(io, name: nil, record: nil, version: nil, derivative: nil, identifier: nil, metadata: {}, **)
18   if record
19     namespace    = record_namespace(record)
20     identifier ||= record_identifier(record)
21   end
22 
23   basename = basic_location(io, metadata: metadata)
24   basename = [*(version || derivative), basename].join("-")
25 
26   [*namespace, *identifier, *name, basename].join("/")
27 end