Class: Relaton::Cli::RelatonDb

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/relaton/cli.rb

Constant Summary collapse

DBCONF =
"#{Dir.home}/.relaton/dbpath".freeze

Instance Method Summary collapse

Instance Method Details

#db(dir) ⇒ Relaton::Db

Parameters:

  • dir (String, nil)

Returns:

  • (Relaton::Db)


21
22
23
24
25
26
27
28
# File 'lib/relaton/cli.rb', line 21

def db(dir)
  if dir
    File.write DBCONF, dir, encoding: "UTF-8"
    @db = Relaton::Db.new dir, nil
  else
    @db ||= Relaton::Db.new dbpath, nil
  end
end