Class: Kiseru::ConfigDir
- Inherits:
-
Object
- Object
- Kiseru::ConfigDir
- Defined in:
- lib/ki_middleman/kiseru.rb
Constant Summary collapse
- DIR_NAME =
'.kiseru'
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #config(app_name) ⇒ Object
- #file(file_name) ⇒ Object
-
#initialize(opts = {}) ⇒ ConfigDir
constructor
A new instance of ConfigDir.
Constructor Details
#initialize(opts = {}) ⇒ ConfigDir
11 12 13 14 15 16 17 |
# File 'lib/ki_middleman/kiseru.rb', line 11 def initialize(opts = {}) root = Pathname.new(File.(opts.fetch(:root) { '~' })) @path = root + DIR_NAME unless File.directory?(@path) Dir.mkdir(@path) end end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/ki_middleman/kiseru.rb', line 9 def path @path end |
Instance Method Details
#config(app_name) ⇒ Object
19 20 21 |
# File 'lib/ki_middleman/kiseru.rb', line 19 def config(app_name) Config.new(@path, app_name) end |
#file(file_name) ⇒ Object
23 24 25 |
# File 'lib/ki_middleman/kiseru.rb', line 23 def file(file_name) @path + file_name end |