Class: Burner::Library::IO::OpenFileBase

Inherits:
JobWithRegister show all
Defined in:
lib/burner/library/io/open_file_base.rb

Overview

Common configuration/code for all IO Job subclasses that open a file.

Direct Known Subclasses

Read, Write

Constant Summary

Constants inherited from JobWithRegister

JobWithRegister::BLANK

Instance Attribute Summary collapse

Attributes inherited from JobWithRegister

#register

Attributes inherited from Job

#name

Instance Method Summary collapse

Methods inherited from Job

#perform

Methods included from Util::Arrayable

#array

Constructor Details

#initialize(path:, binary: false, disk: {}, name: '', register: DEFAULT_REGISTER) ⇒ OpenFileBase

Returns a new instance of OpenFileBase.

Raises:

  • (ArgumentError)


17
18
19
20
21
22
23
24
25
26
27
# File 'lib/burner/library/io/open_file_base.rb', line 17

def initialize(path:, binary: false, disk: {}, name: '', register: DEFAULT_REGISTER)
  super(name: name, register: register)

  raise ArgumentError, 'path is required' if path.to_s.empty?

  @binary = binary || false
  @disk   = Disks.make(disk)
  @path   = path.to_s

  freeze
end

Instance Attribute Details

#binaryObject (readonly)

Returns the value of attribute binary.



15
16
17
# File 'lib/burner/library/io/open_file_base.rb', line 15

def binary
  @binary
end

#diskObject (readonly)

Returns the value of attribute disk.



15
16
17
# File 'lib/burner/library/io/open_file_base.rb', line 15

def disk
  @disk
end

#pathObject (readonly)

Returns the value of attribute path.



15
16
17
# File 'lib/burner/library/io/open_file_base.rb', line 15

def path
  @path
end