Class: ROM::Git::Gateway
- Inherits:
-
ROM::Gateway
- Object
- ROM::Gateway
- ROM::Git::Gateway
- Defined in:
- lib/rom/git/gateway.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #dataset(name) ⇒ Object
- #dataset?(name) ⇒ Boolean
-
#initialize(path, options = {}) ⇒ Gateway
constructor
A new instance of Gateway.
- #reset_data ⇒ Object
Constructor Details
#initialize(path, options = {}) ⇒ Gateway
Returns a new instance of Gateway.
7 8 9 10 11 12 13 |
# File 'lib/rom/git/gateway.rb', line 7 def initialize(path, = {}) super() @path = path @options = @datasets = {} reset_data end |
Instance Method Details
#[](name) ⇒ Object
15 16 17 |
# File 'lib/rom/git/gateway.rb', line 15 def [](name) @datasets[name] end |
#dataset(name) ⇒ Object
19 20 21 |
# File 'lib/rom/git/gateway.rb', line 19 def dataset(name) @datasets[name] = Dataset.new(@connection, path: @path, options: @options, gateway: self) end |
#dataset?(name) ⇒ Boolean
23 24 25 |
# File 'lib/rom/git/gateway.rb', line 23 def dataset?(name) @datasets.key?(name) end |
#reset_data ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/rom/git/gateway.rb', line 27 def reset_data repo = Rugged::Repository.new(@path) walker = Rugged::Walker.new(repo) branch = (@options || {}).fetch(:branch, 'refs/head/master') ref = repo.references[branch] @connection = ref.log rescue [] end |