Class: ROM::Git::Gateway
- Inherits:
-
ROM::Gateway
- Object
- ROM::Gateway
- ROM::Git::Gateway
- Includes:
- Options
- Defined in:
- lib/rom/git/gateway.rb
Constant Summary collapse
- DEFAULT_BRANCH =
'refs/heads/master'.freeze
Instance Attribute Summary collapse
-
#datasets ⇒ Object
readonly
Returns the value of attribute datasets.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #dataset(name) ⇒ Object
- #dataset?(name) ⇒ Boolean
-
#initialize(path, options = EMPTY_HASH) ⇒ Gateway
constructor
A new instance of Gateway.
Constructor Details
#initialize(path, options = EMPTY_HASH) ⇒ Gateway
Returns a new instance of Gateway.
21 22 23 24 25 |
# File 'lib/rom/git/gateway.rb', line 21 def initialize(path, = EMPTY_HASH) super @datasets = {} @repo = Rugged::Repository.new(path) end |
Instance Attribute Details
#datasets ⇒ Object (readonly)
Returns the value of attribute datasets.
17 18 19 |
# File 'lib/rom/git/gateway.rb', line 17 def datasets @datasets end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
19 20 21 |
# File 'lib/rom/git/gateway.rb', line 19 def repo @repo end |
Instance Method Details
#[](name) ⇒ Object
27 28 29 |
# File 'lib/rom/git/gateway.rb', line 27 def [](name) datasets[name] end |
#dataset(name) ⇒ Object
31 32 33 |
# File 'lib/rom/git/gateway.rb', line 31 def dataset(name) datasets[name] = Dataset.new(repo.references[branch].log) end |
#dataset?(name) ⇒ Boolean
35 36 37 |
# File 'lib/rom/git/gateway.rb', line 35 def dataset?(name) datasets.key?(name) end |