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.
14 15 16 17 |
# File 'app/models/storage/hashed.rb', line 14 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
22 23 24 |
# File 'app/models/storage/hashed.rb', line 22 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
30 31 32 |
# File 'app/models/storage/hashed.rb', line 30 def disk_path "#{base_dir}/#{disk_hash}" if disk_hash end |
#rename_repo(old_full_path: nil, new_full_path: nil) ⇒ Object
34 35 36 |
# File 'app/models/storage/hashed.rb', line 34 def rename_repo(old_full_path: nil, new_full_path: nil) true end |