Class: Hyrax::ValkyrieSimplePathGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/hyrax/valkyrie_simple_path_generator.rb

Overview

Provide “simple”, paths for the valkyrie disk storage adapter.

By default, Valkyrie does bucketed/pairtree style paths. Since some of our older on-disk file storage does not do this, we need this to provide backward compatibility.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_path:) ⇒ ValkyrieSimplePathGenerator

Returns a new instance of ValkyrieSimplePathGenerator.


12
13
14
# File 'lib/hyrax/valkyrie_simple_path_generator.rb', line 12

def initialize(base_path:)
  @base_path = base_path
end

Instance Attribute Details

#base_pathObject (readonly)

Returns the value of attribute base_path


10
11
12
# File 'lib/hyrax/valkyrie_simple_path_generator.rb', line 10

def base_path
  @base_path
end

Instance Method Details

#generate(resource:, file:, original_filename:) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument


16
17
18
# File 'lib/hyrax/valkyrie_simple_path_generator.rb', line 16

def generate(resource:, file:, original_filename:) # rubocop:disable Lint/UnusedMethodArgument
  Pathname.new(base_path).join(resource.id, original_filename)
end