Class: Gb::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, work_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, work_branch)
  @remote_branch = remote_branch
  @work_branch = work_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

#work_branchObject (readonly)

Returns the value of attribute work_branch.



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

def work_branch
  @work_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']
  work_branch = node['work_branch']
  return WorkSpaceConfig.new(remote_branch, work_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, 'work_branch' => @work_branch}, file)
  end
end