Class: Cohere::Transcribe::State::SourceSnapshot

Inherits:
Data
  • Object
show all
Defined in:
lib/cohere/transcribe/state/io.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#canonical_pathObject (readonly)

Returns the value of attribute canonical_path

Returns:

  • (Object)

    the current value of canonical_path



323
324
325
# File 'lib/cohere/transcribe/state/io.rb', line 323

def canonical_path
  @canonical_path
end

#ctime_nsObject (readonly)

Returns the value of attribute ctime_ns

Returns:

  • (Object)

    the current value of ctime_ns



323
324
325
# File 'lib/cohere/transcribe/state/io.rb', line 323

def ctime_ns
  @ctime_ns
end

#deviceObject (readonly)

Returns the value of attribute device

Returns:

  • (Object)

    the current value of device



323
324
325
# File 'lib/cohere/transcribe/state/io.rb', line 323

def device
  @device
end

#inodeObject (readonly)

Returns the value of attribute inode

Returns:

  • (Object)

    the current value of inode



323
324
325
# File 'lib/cohere/transcribe/state/io.rb', line 323

def inode
  @inode
end

#mtime_nsObject (readonly)

Returns the value of attribute mtime_ns

Returns:

  • (Object)

    the current value of mtime_ns



323
324
325
# File 'lib/cohere/transcribe/state/io.rb', line 323

def mtime_ns
  @mtime_ns
end

#sizeObject (readonly)

Returns the value of attribute size

Returns:

  • (Object)

    the current value of size



323
324
325
# File 'lib/cohere/transcribe/state/io.rb', line 323

def size
  @size
end

Class Method Details

.capture(path) ⇒ Object



331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/cohere/transcribe/state/io.rb', line 331

def self.capture(path)
  canonical = Pathname(path).realpath
  stat = canonical.stat
  new(
    canonical_path: canonical.to_s.freeze,
    device: stat.dev,
    inode: stat.ino,
    size: stat.size,
    mtime_ns: State.time_nanoseconds(stat.mtime),
    ctime_ns: State.time_nanoseconds(stat.ctime)
  )
end

Instance Method Details

#payloadObject



344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/cohere/transcribe/state/io.rb', line 344

def payload
  {
    "canonical_path" => canonical_path,
    "snapshot" => {
      "device" => device,
      "inode" => inode,
      "size" => size,
      "mtime_ns" => mtime_ns,
      "ctime_ns" => ctime_ns
    }
  }
end