struct
Agate::Attributes
- Agate::Attributes
- Struct
- Value
- Object
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
- Enumerable({String, Bool | String | Nil})
Defined in:
agate/attr.crInstance Method Summary
-
#[](name : String) : AttrValue
Looks up a single attribute by name.
-
#[]?(name : String) : AttrValue
Looks up a single attribute by name (same as
#[]since the return type is already nilable for unspecified attributes). -
#each(& : Tuple(String, AttrValue) -> ) : Nil
Iterates over all attributes defined for this path.
-
#get(names : Array(String)) : Hash(String, AttrValue)
Looks up multiple attributes at once (more efficient than individual lookups).
-
#get(*names : String) : Hash(String, AttrValue)
Looks up multiple attributes at once (more efficient than individual lookups).
-
#to_h : Hash(String, AttrValue)
Returns all attributes for this path as a Hash.
Instance Method Detail
Looks up a single attribute by name (same as #[] since
the return type is already nilable for unspecified attributes).
Iterates over all attributes defined for this path.
Looks up multiple attributes at once (more efficient than individual lookups).
Looks up multiple attributes at once (more efficient than individual lookups).