class TDP::Patch

A single patch.

Attributes

content[R]

Content of the patch.

full_filename[R]

Full name of the patch file.

name[R]

Name of the patch.

signature[R]

SHA-256 hash of content.

Public Class Methods

new(full_filename) click to toggle source
full_filename

full path to .sql file

# File lib/tdp.rb, line 114
def initialize(full_filename)
  @full_filename = full_filename
  _, @name = File.split(full_filename)
  @content = File.read(full_filename)
  @signature = Digest::SHA256.hexdigest(@content)
end

Public Instance Methods

<=>(other) click to toggle source

Comparison function. Any permanent patch takes precedence over any volatile one, if both patches are permanent or both are volatile, ordering is based on name.

# File lib/tdp.rb, line 140
def <=>(other)
  return -1 if permanent? && other.volatile?
  return 1 if volatile? && other.permanent?
  @name <=> other.name
end
permanent?() click to toggle source

Returns true if patch is permanent.

# File lib/tdp.rb, line 131
def permanent?
  TDP.permanent_patch_file?(@name)
end
volatile?() click to toggle source

Returns true if patch is volatile.

# File lib/tdp.rb, line 124
def volatile?
  TDP.volatile_patch_file?(@name)
end