Class: KStarter::Database::BaseModel

Inherits:
Object
  • Object
show all
Defined in:
lib/k_starter/database/base_model.rb

Overview

Handle access to project data and configuration JSON files

Direct Known Subclasses

ConfigModel, ProjectModel

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ BaseModel

Split Config and Data into two classes



13
14
15
16
17
18
# File 'lib/k_starter/database/base_model.rb', line 13

def initialize(**args)
  @folder = args[:folder] || '~/.config'
  @folder = File.expand_path(folder)
  @backup_folder = File.join(folder, 'klue_backup')
  @filename = File.join(@folder, args[:file])
end

Instance Attribute Details

#backup_folderObject (readonly)

Returns the value of attribute backup_folder.



8
9
10
# File 'lib/k_starter/database/base_model.rb', line 8

def backup_folder
  @backup_folder
end

#dataObject (readonly)

Returns the value of attribute data.



10
11
12
# File 'lib/k_starter/database/base_model.rb', line 10

def data
  @data
end

#filenameObject (readonly)

Returns the value of attribute filename.



9
10
11
# File 'lib/k_starter/database/base_model.rb', line 9

def filename
  @filename
end

#folderObject (readonly)

Returns the value of attribute folder.



7
8
9
# File 'lib/k_starter/database/base_model.rb', line 7

def folder
  @folder
end