Class: ROM::Git::Gateway

Inherits:
ROM::Gateway
  • Object
show all
Extended by:
Initializer
Defined in:
lib/rom/git/gateway.rb

Constant Summary collapse

DEFAULT_BRANCH =
'refs/heads/master'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#branchString (readonly)


19
# File 'lib/rom/git/gateway.rb', line 19

option :branch, Types::Coercible::String, default: proc { DEFAULT_BRANCH }

#pathString (readonly)


16
# File 'lib/rom/git/gateway.rb', line 16

param :path, Types::Coercible::String

#repoRugged::Repository (readonly)


22
# File 'lib/rom/git/gateway.rb', line 22

option :repo, Types.Instance(Rugged::Repository), default: proc { Rugged::Repository.new(path) }

Instance Method Details

#[](name) ⇒ Dataset


30
31
32
# File 'lib/rom/git/gateway.rb', line 30

def [](name)
  datasets[name]
end

#dataset(name) ⇒ Dataset


35
36
37
# File 'lib/rom/git/gateway.rb', line 35

def dataset(name)
  datasets[name] = Dataset.new(repo.references[branch].log)
end

#dataset?(name) ⇒ Boolean


40
41
42
# File 'lib/rom/git/gateway.rb', line 40

def dataset?(name)
  datasets.key?(name)
end

#datasetsHash


25
26
27
# File 'lib/rom/git/gateway.rb', line 25

def datasets
  @datasets ||= {}
end