Class: RubySMB::Server::Share::Provider::Disk

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_smb/server/share/provider/disk.rb,
lib/ruby_smb/server/share/provider/disk/processor.rb,
lib/ruby_smb/server/share/provider/disk/file_system.rb,
lib/ruby_smb/server/share/provider/disk/processor/read.rb,
lib/ruby_smb/server/share/provider/disk/processor/close.rb,
lib/ruby_smb/server/share/provider/disk/processor/query.rb,
lib/ruby_smb/server/share/provider/disk/processor/create.rb

Overview

This is a share provider that exposes the local file system.

Direct Known Subclasses

VirtualDisk

Defined Under Namespace

Modules: FileSystem Classes: Processor

Constant Summary collapse

TYPE =
TYPE_DISK
FILE_SYSTEM =

emulate NTFS just like Samba does

FileSystem::NTFS

Instance Attribute Summary collapse

Attributes inherited from Base

#hooks, #name

Instance Method Summary collapse

Methods inherited from Base

#add_hook, #new_processor, #remove_hook, #type

Constructor Details

#initialize(name, path, hooks: nil) ⇒ Disk

Returns a new instance of Disk.

Parameters:

  • name (String)

    The name of this share.

  • path (String, Pathname)

    The local file system path to share. This path must be an absolute path to an existing directory.

Raises:

  • (ArgumentError)


17
18
19
20
21
22
23
24
# File 'lib/ruby_smb/server/share/provider/disk.rb', line 17

def initialize(name, path, hooks: nil)
  path = Pathname.new(File.expand_path(path)) if path.is_a?(String)
  raise ArgumentError.new('path must be a directory') unless path.directory? # it needs to exist
  raise ArgumentError.new('path must be absolute') unless path.absolute? # it needs to be absolute so it is independent of the cwd

  @path = path
  super(name, hooks: hooks)
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



26
27
28
# File 'lib/ruby_smb/server/share/provider/disk.rb', line 26

def path
  @path
end