Class: ROM::Git::Adapter
- Inherits:
-
Adapter
- Object
- Adapter
- ROM::Git::Adapter
- Defined in:
- lib/rom/git/adapter.rb
Defined Under Namespace
Classes: Dataset
Class Method Summary collapse
Instance Method Summary collapse
- #[](_name) ⇒ Object
- #dataset(_name, _header) ⇒ Object
- #dataset?(_name) ⇒ Boolean
-
#initialize(*args) ⇒ Adapter
constructor
Expect a path to a single csv file which will be registered by rom to the given name or :default as the repository.
Constructor Details
#initialize(*args) ⇒ Adapter
Expect a path to a single csv file which will be registered by rom to the given name or :default as the repository.
26 27 28 29 30 31 32 33 34 |
# File 'lib/rom/git/adapter.rb', line 26 def initialize(*args) super repo = Rugged::Repository.new(uri.path) walker = Rugged::Walker.new(repo) branch = ( || {}).fetch(:branch, 'refs/head/master') ref = repo.references[branch] @connection = ref.log rescue [] end |
Class Method Details
.schemes ⇒ Object
4 5 6 |
# File 'lib/rom/git/adapter.rb', line 4 def self.schemes [:git] end |
Instance Method Details
#[](_name) ⇒ Object
36 37 38 |
# File 'lib/rom/git/adapter.rb', line 36 def [](_name) connection end |
#dataset(_name, _header) ⇒ Object
40 41 42 |
# File 'lib/rom/git/adapter.rb', line 40 def dataset(_name, _header) Dataset.new(connection) end |
#dataset?(_name) ⇒ Boolean
44 45 46 |
# File 'lib/rom/git/adapter.rb', line 44 def dataset?(_name) connection end |