Class: YumRepo::Settings

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSettings

Returns a new instance of Settings.



32
33
34
35
36
37
38
39
# File 'lib/yumrepo.rb', line 32

def initialize
  @cache_path = "#{ENV['HOME']}/.yumrepo/cache/"
  # Cache expire in seconds
  @cache_expire = 3600
  @cache_enabled = true
  @initialized = false
  @log_level = :info
end

Instance Attribute Details

#cache_enabledObject

Returns the value of attribute cache_enabled.



30
31
32
# File 'lib/yumrepo.rb', line 30

def cache_enabled
  @cache_enabled
end

#cache_expireObject

Returns the value of attribute cache_expire.



30
31
32
# File 'lib/yumrepo.rb', line 30

def cache_expire
  @cache_expire
end

#cache_pathObject

Returns the value of attribute cache_path.



30
31
32
# File 'lib/yumrepo.rb', line 30

def cache_path
  @cache_path
end

#log_levelObject

Returns the value of attribute log_level.



30
31
32
# File 'lib/yumrepo.rb', line 30

def log_level
  @log_level
end

Instance Method Details

#initObject



63
64
65
66
67
68
69
70
# File 'lib/yumrepo.rb', line 63

def init
  if @initialized
    log.debug "Settings already initialized"
    return
  end
  log.debug "Initializing settings"
  @initialized = true
end

#logObject



59
60
61
# File 'lib/yumrepo.rb', line 59

def log
  @log ||= Logger.new($stdout)
end