Class: Vnstat::Configuration
- Inherits:
-
Object
- Object
- Vnstat::Configuration
- Defined in:
- lib/vnstat/configuration.rb
Overview
A class encapsulating configurations of the Vnstat environment.
Instance Attribute Summary collapse
-
#executable_path ⇒ String
Returns the location of the vnstat executable.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Initializes the Configuration.
-
#reset ⇒ Configuration
Restores the configuration defaults.
Constructor Details
#initialize ⇒ Configuration
Initializes the Vnstat::Configuration.
12 13 14 |
# File 'lib/vnstat/configuration.rb', line 12 def initialize reset end |
Instance Attribute Details
#executable_path ⇒ String
Returns the location of the vnstat executable.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vnstat/configuration.rb', line 9 class Configuration ## # Initializes the {Configuration}. def initialize reset end ## # Restores the configuration defaults. # # @return [Configuration] def reset @executable_path = nil self end ## # Returns the location of the vnstat executable. # # @return [String] def executable_path @executable_path ||= Utils.system_call('which', 'vnstat') do raise ExecutableNotFound, 'Unable to locate vnstat executable' end end attr_writer :executable_path end |
Instance Method Details
#reset ⇒ Configuration
Restores the configuration defaults.
20 21 22 23 |
# File 'lib/vnstat/configuration.rb', line 20 def reset @executable_path = nil self end |