class Front::CLI::Frontfile

Attributes

data[R]
path[R]

Public Class Methods

new(path) click to toggle source
# File lib/front/cli/front_file.rb, line 9
def initialize(path)
  @path = path
end

Public Instance Methods

create(defaults) click to toggle source
# File lib/front/cli/front_file.rb, line 17
def create(defaults)
  @data = defaults
  save()
end
exists?() click to toggle source
# File lib/front/cli/front_file.rb, line 13
def exists?
  File.exists?(path)
end
get_current_id() click to toggle source
# File lib/front/cli/front_file.rb, line 34
def get_current_id
  @data['current_id']
end
get_pool_size() click to toggle source
# File lib/front/cli/front_file.rb, line 42
def get_pool_size
  @data['pool_size']
end
load() click to toggle source
# File lib/front/cli/front_file.rb, line 22
def load
  file_contents = File.read(path)
  @data = JSON.parse(file_contents)
end
save() click to toggle source
# File lib/front/cli/front_file.rb, line 27
def save
  json = @data.to_json
  File.open(path, 'w') do |file|
    file.write(json)
  end
end
set_current_id(current_id) click to toggle source
# File lib/front/cli/front_file.rb, line 38
def set_current_id(current_id)
  @data['current_id'] = current_id
end
set_pool_size(pool_size) click to toggle source
# File lib/front/cli/front_file.rb, line 46
def set_pool_size(pool_size)
  @data['pool_size'] = pool_size
end