Class: Macdiff::App

Inherits:
Object
  • Object
show all
Defined in:
lib/macdiff/app.rb

Overview

Handle the global access such as configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApp

Returns a new instance of App.



10
11
12
13
14
15
16
17
18
# File 'lib/macdiff/app.rb', line 10

def initialize
  @config = TTY::Config.new
  @config.filename = 'macdiff'
  @config.extname = '.yml'
  # @config.append_path Dir.pwd # Dir.home
  @config.append_path File.join(Dir.home, '.config')
  @config.write unless @config.exist?
  @config.read
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/macdiff/app.rb', line 8

def config
  @config
end

Class Method Details

.configObject



20
21
22
# File 'lib/macdiff/app.rb', line 20

def self.config
  @config ||= new.config
end