Sha256: 6832799ca03454437dc85a2137a7dd0f52db407020b1d8a4833719157c3aac9f

Contents?: true

Size: 719 Bytes

Versions: 2

Compression:

Stored size: 719 Bytes

Contents

# frozen_string_literal: true
module Ferver
  class Configuration
    # By default, serve files from current location when the gem is called.
    DEFAULT_FILE_SERVER_DIR_PATH = "./".freeze

    # Return the absolute path to the directory Ferver is serving files from.
    attr_accessor :directory_path

    # Default to not serving hidden files.
    attr_accessor :serve_hidden

    # For testing
    attr_writer :directory

    alias serve_hidden? serve_hidden

    def initialize(directory_path = DEFAULT_FILE_SERVER_DIR_PATH, serve_hidden = false)
      @directory_path = directory_path
      @serve_hidden   = serve_hidden
    end

    def directory
      @directory ||= FerverDirectory.new(self)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ferver-1.4.0 lib/ferver/configuration.rb
ferver-1.3.1 lib/ferver/configuration.rb