Class: DurableHuggingfaceHub::Types::CachedRevisionInfo
- Inherits:
-
Struct
- Object
- Dry::Struct
- Struct
- DurableHuggingfaceHub::Types::CachedRevisionInfo
- Includes:
- Loadable
- Defined in:
- lib/durable_huggingface_hub/types/cache_info.rb
Overview
Information about a cached repository revision.
Represents a specific revision (commit, branch, or tag) of a repository in the cache.
Instance Attribute Summary collapse
-
#commit_hash ⇒ String
readonly
Git commit hash for this revision.
-
#files ⇒ Array<CachedFileInfo>
readonly
List of cached files in this revision.
-
#last_modified ⇒ Time?
readonly
When this revision was last modified.
-
#refs ⇒ Array<String>
readonly
List of refs (branches/tags) pointing to this commit.
-
#size ⇒ Integer
readonly
Total size of all files in this revision.
Instance Method Summary collapse
-
#file_count ⇒ Integer
Number of files in this revision.
-
#size_str ⇒ String
Human-readable size string.
Instance Attribute Details
#commit_hash ⇒ String (readonly)
Git commit hash for this revision
88 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 88 attribute :commit_hash, Types::String |
#files ⇒ Array<CachedFileInfo> (readonly)
List of cached files in this revision
98 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 98 attribute :files, Types::Array.of(CachedFileInfo) |
#last_modified ⇒ Time? (readonly)
When this revision was last modified
108 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 108 attribute :last_modified, Types::OptionalTimestamp.default(nil) |
#refs ⇒ Array<String> (readonly)
List of refs (branches/tags) pointing to this commit
93 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 93 attribute :refs, Types::StringArray |
#size ⇒ Integer (readonly)
Total size of all files in this revision
103 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 103 attribute :size, Types::Integer |
Instance Method Details
#file_count ⇒ Integer
Number of files in this revision.
129 130 131 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 129 def file_count files.length end |
#size_str ⇒ String
Human-readable size string.
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 113 def size_str units = ["B", "KB", "MB", "GB", "TB"] size = self.size.to_f unit_index = 0 while size >= 1024 && unit_index < units.length - 1 size /= 1024.0 unit_index += 1 end format("%.2f %s", size, units[unit_index]) end |