Class: EacGit::Local::Subrepo::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_git/local/subrepo/config.rb

Constant Summary collapse

MAPPING =
{
  command_version: :cmdver, commit_id: :commit, join_method: :method,
  parent_commit_id: :parent, remote_branch: :branch, remote_uri: :remote
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_file(file_path) ⇒ Object



16
17
18
19
20
# File 'lib/eac_git/local/subrepo/config.rb', line 16

def from_file(file_path)
  new(
    ::ParseConfig.new(file_path.to_pathname)['subrepo']
  )
end

Instance Method Details

#to_contentObject



37
38
39
# File 'lib/eac_git/local/subrepo/config.rb', line 37

def to_content
  "[subrepo]\n" + MAPPING.map { |k, v| "  #{v} = #{send(k)}\n" }.join
end