Class: DurableHuggingfaceHub::Types::GitRefInfo
- Includes:
- Loadable
- Defined in:
- lib/durable_huggingface_hub/types/commit_info.rb
Overview
Information about a Git reference (branch or tag) in a HuggingFace Hub repository.
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Reference name (e.g., “main”, “v1.0.0”).
-
#ref ⇒ String
readonly
Full reference path (e.g., “refs/heads/main”).
-
#target_commit ⇒ String?
readonly
Target commit OID.
Instance Method Summary collapse
-
#branch? ⇒ Boolean
Checks if this is a branch reference.
-
#inspect ⇒ String
Returns a detailed inspection string.
-
#ref_type ⇒ String
Returns the reference type.
-
#tag? ⇒ Boolean
Checks if this is a tag reference.
-
#to_s ⇒ String
Returns a short description of the ref.
Instance Attribute Details
#name ⇒ String (readonly)
Returns Reference name (e.g., “main”, “v1.0.0”).
97 |
# File 'lib/durable_huggingface_hub/types/commit_info.rb', line 97 attribute :name, Types::String |
#ref ⇒ String (readonly)
Returns Full reference path (e.g., “refs/heads/main”).
101 |
# File 'lib/durable_huggingface_hub/types/commit_info.rb', line 101 attribute :ref, Types::String |
#target_commit ⇒ String? (readonly)
Returns Target commit OID.
105 |
# File 'lib/durable_huggingface_hub/types/commit_info.rb', line 105 attribute :target_commit, Types::OptionalString.default(nil) |
Instance Method Details
#branch? ⇒ Boolean
Checks if this is a branch reference.
112 113 114 |
# File 'lib/durable_huggingface_hub/types/commit_info.rb', line 112 def branch? ref.start_with?("refs/heads/") end |
#inspect ⇒ String
Returns a detailed inspection string.
143 144 145 146 |
# File 'lib/durable_huggingface_hub/types/commit_info.rb', line 143 def inspect "#<#{self.class.name} name=#{name.inspect} type=#{ref_type} " \ "commit=#{target_commit&.[](0, 7).inspect}>" end |
#ref_type ⇒ String
Returns the reference type.
126 127 128 129 130 131 |
# File 'lib/durable_huggingface_hub/types/commit_info.rb', line 126 def ref_type return "branch" if branch? return "tag" if tag? "unknown" end |
#tag? ⇒ Boolean
Checks if this is a tag reference.
119 120 121 |
# File 'lib/durable_huggingface_hub/types/commit_info.rb', line 119 def tag? ref.start_with?("refs/tags/") end |
#to_s ⇒ String
Returns a short description of the ref.
136 137 138 |
# File 'lib/durable_huggingface_hub/types/commit_info.rb', line 136 def to_s "#{ref_type}: #{name}" end |