Class: Cohere::Transcribe::State::DirectoryBinding
- Inherits:
-
Data
- Object
- Data
- Cohere::Transcribe::State::DirectoryBinding
- Defined in:
- lib/cohere/transcribe/state/io.rb
Instance Attribute Summary collapse
-
#access_path ⇒ Object
readonly
Returns the value of attribute access_path.
-
#canonical_path ⇒ Object
readonly
Returns the value of attribute canonical_path.
-
#device ⇒ Object
readonly
Returns the value of attribute device.
-
#inode ⇒ Object
readonly
Returns the value of attribute inode.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#access_path ⇒ Object (readonly)
Returns the value of attribute access_path
20 21 22 |
# File 'lib/cohere/transcribe/state/io.rb', line 20 def access_path @access_path end |
#canonical_path ⇒ Object (readonly)
Returns the value of attribute canonical_path
20 21 22 |
# File 'lib/cohere/transcribe/state/io.rb', line 20 def canonical_path @canonical_path end |
#device ⇒ Object (readonly)
Returns the value of attribute device
20 21 22 |
# File 'lib/cohere/transcribe/state/io.rb', line 20 def device @device end |
#inode ⇒ Object (readonly)
Returns the value of attribute inode
20 21 22 |
# File 'lib/cohere/transcribe/state/io.rb', line 20 def inode @inode end |
Class Method Details
.capture(path) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cohere/transcribe/state/io.rb', line 26 def self.capture(path) access_path = Pathname(path)..cleanpath canonical_path = access_path.realpath stat = canonical_path.lstat unless stat.directory? && !stat.symlink? raise TranscriptionRuntimeError, "Publication parent is not a real directory: #{access_path}" end new( access_path: access_path.freeze, canonical_path: canonical_path.freeze, device: stat.dev, inode: stat.ino ) rescue SystemCallError, ArgumentError => e raise TranscriptionRuntimeError, "Cannot bind publication parent #{path}: #{e.}" end |
Instance Method Details
#verify! ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cohere/transcribe/state/io.rb', line 45 def verify! resolved = access_path.realpath stat = canonical_path.lstat valid = resolved == canonical_path && stat.directory? && !stat.symlink? && stat.dev == device && stat.ino == inode return self if valid raise TranscriptionRuntimeError, "Publication parent changed after planning: #{access_path}" rescue SystemCallError, ArgumentError => e raise TranscriptionRuntimeError, "Publication parent changed after planning: #{access_path} (#{e.})" end |