Class: Kiseru::ConfigDir

Inherits:
Object
  • Object
show all
Defined in:
lib/ki_youtrack/kiseru.rb

Constant Summary collapse

NAME =
'.kiseru'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ ConfigDir

Returns a new instance of ConfigDir.



14
15
16
17
18
19
20
21
22
# File 'lib/ki_youtrack/kiseru.rb', line 14

def initialize(opts = {})
  name = opts.fetch(:name) { NAME }
  root = Pathname.new(File.expand_path(opts.fetch(:root) { '~' }))
  @path = root + name
  unless File.directory?(@path)
    Dir.mkdir(@path)
    FileUtils.chmod(0700, @path)
  end
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



12
13
14
# File 'lib/ki_youtrack/kiseru.rb', line 12

def path
  @path
end

Instance Method Details

#config(app_name) ⇒ Object



24
25
26
# File 'lib/ki_youtrack/kiseru.rb', line 24

def config(app_name)
  Config.new(@path, app_name)
end