Class: Gitl::WorkSpaceConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/config/work_space_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(remote_branch, workspace_branch) ⇒ WorkSpaceConfig

Returns a new instance of WorkSpaceConfig.



7
8
9
10
# File 'lib/config/work_space_config.rb', line 7

def initialize(remote_branch, workspace_branch)
  @remote_branch = remote_branch
  @workspace_branch = workspace_branch
end

Instance Attribute Details

#remote_branchObject (readonly)

Returns the value of attribute remote_branch.



4
5
6
# File 'lib/config/work_space_config.rb', line 4

def remote_branch
  @remote_branch
end

#workspace_branchObject (readonly)

Returns the value of attribute workspace_branch.



5
6
7
# File 'lib/config/work_space_config.rb', line 5

def workspace_branch
  @workspace_branch
end

Class Method Details

.load_file(yaml_filename) ⇒ Object



12
13
14
15
16
17
# File 'lib/config/work_space_config.rb', line 12

def self.load_file(yaml_filename)
  node = YAML.load_file(yaml_filename)
  remote_branch = node['remote_branch']
  workspace_branch = node['workspace_branch']
  return WorkSpaceConfig.new(remote_branch, workspace_branch)
end

Instance Method Details

#save(path) ⇒ Object



19
20
21
22
23
# File 'lib/config/work_space_config.rb', line 19

def save(path)
  File.open(path, 'w') do |file|
    Psych.dump({'remote_branch' => @remote_branch, 'workspace_branch' => @workspace_branch}, file)
  end
end