struct Agate::OID

Overview

Represents a git object ID (SHA1 hash).

Included Modules

Defined in:

agate/oid.cr

Constant Summary

HEXSIZE = C::SHA1_HEXSIZE

The size in hex characters of a formatted SHA1 OID.

SIZE = C::SHA1_SIZE

The size in bytes of a raw SHA1 OID.

ZERO = new(C::OID.new)

An all-zero OID.

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.parse(hex : String) : OID #

Parses a hex string into an OID.


[View source]

Class Method Detail

def self.parse?(hex : String) : OID | Nil #

Parses a (possibly abbreviated) hex string into an OID.


[View source]
def self.valid?(hex : String) : Bool #

Returns true if the given string is a valid full 40-character hex OID.


[View source]

Instance Method Detail

def <=>(other : OID) : Int32 #

Three-way comparison.


[View source]
def ==(other : OID) : Bool #

Equality comparison.


[View source]
def ==(hex : String) : Bool #

Equality comparison with a hex string.


[View source]
def hex : String #

Returns the hex string representation of this OID.


[View source]
def to_s(io : IO) : Nil #

Returns the hex string representation of this OID.


[View source]
def zero? : Bool #

Returns true if this OID is all zeros.


[View source]