Sha256: c0a8b667ebe500e7bd4454395d5d40d1f70bd330dfe2474108a5be251e3a4a14

Contents?: true

Size: 777 Bytes

Versions: 7

Compression:

Stored size: 777 Bytes

Contents

# frozen_string_literal: true

module Vnstat
  ##
  # A class encapsulating configurations of the Vnstat environment.
  #
  # @!attribute executable_path
  #   @return 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
        raise ExecutableNotFound, 'Unable to locate vnstat executable'
      end
    end

    attr_writer :executable_path
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vnstat-ruby-3.0.7 lib/vnstat/configuration.rb
vnstat-ruby-3.0.6 lib/vnstat/configuration.rb
vnstat-ruby-3.0.5 lib/vnstat/configuration.rb
vnstat-ruby-3.0.4 lib/vnstat/configuration.rb
vnstat-ruby-3.0.2 lib/vnstat/configuration.rb
vnstat-ruby-3.0.0 lib/vnstat/configuration.rb
vnstat-ruby-2.0.0 lib/vnstat/configuration.rb