Class: Storage::Hashed
- Inherits:
-
Object
- Object
- Storage::Hashed
- Defined in:
- app/models/storage/hashed.rb
Constant Summary collapse
- REPOSITORY_PATH_PREFIX =
'@hashed'
- GROUP_REPOSITORY_PATH_PREFIX =
'@groups'
- SNIPPET_REPOSITORY_PATH_PREFIX =
'@snippets'
- POOL_PATH_PREFIX =
'@pools'
Instance Attribute Summary collapse
-
#container ⇒ Object
Returns the value of attribute container.
Instance Method Summary collapse
-
#base_dir ⇒ String
Base directory.
-
#disk_path ⇒ String
Disk path is used to build repository path on disk.
-
#initialize(container, prefix: REPOSITORY_PATH_PREFIX) ⇒ Hashed
constructor
A new instance of Hashed.
- #rename_repo(old_full_path: nil, new_full_path: nil) ⇒ Object
Constructor Details
#initialize(container, prefix: REPOSITORY_PATH_PREFIX) ⇒ Hashed
Returns a new instance of Hashed.
13 14 15 16 |
# File 'app/models/storage/hashed.rb', line 13 def initialize(container, prefix: REPOSITORY_PATH_PREFIX) @container = container @prefix = prefix end |
Instance Attribute Details
#container ⇒ Object
Returns the value of attribute container
5 6 7 |
# File 'app/models/storage/hashed.rb', line 5 def container @container end |
Instance Method Details
#base_dir ⇒ String
Base directory
21 22 23 |
# File 'app/models/storage/hashed.rb', line 21 def base_dir "#{@prefix}/#{disk_hash[0..1]}/#{disk_hash[2..3]}" if disk_hash end |
#disk_path ⇒ String
Disk path is used to build repository path on disk
without `.git`, `.wiki.git`, or any other extension
29 30 31 |
# File 'app/models/storage/hashed.rb', line 29 def disk_path "#{base_dir}/#{disk_hash}" if disk_hash end |
#rename_repo(old_full_path: nil, new_full_path: nil) ⇒ Object
33 34 35 |
# File 'app/models/storage/hashed.rb', line 33 def rename_repo(old_full_path: nil, new_full_path: nil) true end |