Sha256: d569d7fb3e15499c74d4f168a7fb4634c0483cc3a474f994e5ed2d4f33bff690

Contents?: true

Size: 752 Bytes

Versions: 6

Compression:

Stored size: 752 Bytes

Contents

module Vnstat
  ##
  # A class encapsulating configurations of the Vnstat environment.
  #
  # @attr_writer [String] executable_path Sets the location of the vnstat
  #   executable.
  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
        fail ExecutableNotFound, 'Unable to locate vnstat executable'
      end
    end

    attr_writer :executable_path
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vnstat-ruby-1.0.5 lib/vnstat/configuration.rb
vnstat-ruby-1.0.4 lib/vnstat/configuration.rb
vnstat-ruby-1.0.3 lib/vnstat/configuration.rb
vnstat-ruby-1.0.2 lib/vnstat/configuration.rb
vnstat-ruby-1.0.1 lib/vnstat/configuration.rb
vnstat-ruby-1.0.0 lib/vnstat/configuration.rb