Class: RubySMB::Server::Share::Provider::VirtualDisk::VirtualDynamicFile
- Inherits:
-
VirtualPathname
- Object
- VirtualPathname
- RubySMB::Server::Share::Provider::VirtualDisk::VirtualDynamicFile
- Defined in:
- lib/ruby_smb/server/share/provider/virtual_disk/virtual_file.rb
Overview
A dynamic file is one whose contents are generated by the specified block.
Constant Summary
Constants inherited from VirtualPathname
RubySMB::Server::Share::Provider::VirtualDisk::VirtualPathname::SEPARATOR
Instance Attribute Summary
Attributes inherited from VirtualPathname
Instance Method Summary collapse
- #generate(server_client, session) ⇒ Object
-
#initialize(disk, path, stat: nil, &block) ⇒ VirtualDynamicFile
constructor
A new instance of VirtualDynamicFile.
Methods inherited from VirtualPathname
#<=>, #==, #absolute?, #basename, basename, #children, #cleanpath, cleanpath, dirname, #dirname, #entries, #exist?, #extname, #join, #relative?, #split, #stat, #to_s
Constructor Details
#initialize(disk, path, stat: nil, &block) ⇒ VirtualDynamicFile
Returns a new instance of VirtualDynamicFile.
15 16 17 18 19 20 21 |
# File 'lib/ruby_smb/server/share/provider/virtual_disk/virtual_file.rb', line 15 def initialize(disk, path, stat: nil, &block) raise ArgumentError.new('a generation block must be specified') if block.nil? @content_generator = block super(disk, path) @stat = stat end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RubySMB::Server::Share::Provider::VirtualDisk::VirtualPathname
Instance Method Details
#generate(server_client, session) ⇒ Object
23 24 25 26 |
# File 'lib/ruby_smb/server/share/provider/virtual_disk/virtual_file.rb', line 23 def generate(server_client, session) content = @content_generator.call(server_client, session) VirtualStaticFile.new(@virtual_disk, @path, content, stat: @stat) end |