struct Agate::Attributes

Overview

Attribute lookup proxy for a specific path in a repository.

attrs = repo.attributes("lib/main.cr")
attrs["text"]   # => true
attrs["diff"]   # => "crystal"
attrs["binary"] # => nil (unspecified)

attrs.to_h # => {"text" => true, "diff" => "crystal", ...}

Included Modules

Defined in:

agate/attr.cr

Instance Method Summary

Instance Method Detail

def [](name : String) : AttrValue #

Looks up a single attribute by name.


[View source]
def []?(name : String) : AttrValue #

Looks up a single attribute by name (same as #[] since the return type is already nilable for unspecified attributes).


[View source]
def each(& : Tuple(String, AttrValue) -> ) : Nil #

Iterates over all attributes defined for this path.


[View source]
def get(names : Array(String)) : Hash(String, AttrValue) #

Looks up multiple attributes at once (more efficient than individual lookups).


[View source]
def get(*names : String) : Hash(String, AttrValue) #

Looks up multiple attributes at once (more efficient than individual lookups).


[View source]
def to_h : Hash(String, AttrValue) #

Returns all attributes for this path as a Hash.


[View source]