Class: Rugged::Repository::Attributes
- Inherits:
-
Object
- Object
- Rugged::Repository::Attributes
- Includes:
- Enumerable
- Defined in:
- lib/rugged/attributes.rb
Constant Summary collapse
- LOAD_PRIORITIES =
{ [:file, :index] => 0, [:index, :file] => 1, [:index] => 2, }
Class Method Summary collapse
Instance Method Summary collapse
- #[](attribute) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(repository, path, options = {}) ⇒ Attributes
constructor
A new instance of Attributes.
- #to_h ⇒ Object
Constructor Details
#initialize(repository, path, options = {}) ⇒ Attributes
Returns a new instance of Attributes.
22 23 24 25 26 |
# File 'lib/rugged/attributes.rb', line 22 def initialize(repository, path, = {}) @repository = repository @path = path @load_flags = Attributes.parse_opts() end |
Class Method Details
.parse_opts(opt) ⇒ Object
16 17 18 19 20 |
# File 'lib/rugged/attributes.rb', line 16 def self.parse_opts(opt) flags = LOAD_PRIORITIES[opt[:priority]] || 0 flags |= 4 if opt[:skip_system] flags end |
Instance Method Details
#[](attribute) ⇒ Object
28 29 30 |
# File 'lib/rugged/attributes.rb', line 28 def [](attribute) @repository.fetch_attributes(@path, attribute, @load_flags) end |
#each(&block) ⇒ Object
36 37 38 |
# File 'lib/rugged/attributes.rb', line 36 def each(&block) to_h.each(&block) end |
#to_h ⇒ Object
32 33 34 |
# File 'lib/rugged/attributes.rb', line 32 def to_h @hash ||= @repository.fetch_attributes(@path, nil, @load_flags) end |