Module: Ibex::VerificationReport::LogicalPath

Defined in:
lib/ibex/verification_report/logical_path.rb

Overview

Closed logical identities used by version 1 verification reports.

Constant Summary collapse

MAX_INPUT_FILES =

: Integer

10_000
BASENAME =

: Regexp

%r{\A(?!\.{1,2}\z)[^/\\\x00-\x1f\x7f]+\z}
INPUT =

: Regexp

%r{\Ainput/(?<index>[0-9]{4})/(?<basename>[^/\\\x00-\x1f\x7f]+)\z}
TABLE =

: Regexp

%r{\Atable/(?<basename>[^/\\\x00-\x1f\x7f]+)\z}

Class Method Summary collapse

Class Method Details

.canonical_input?(value, index) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
34
35
36
37
38
# File 'lib/ibex/verification_report/logical_path.rb', line 30

def canonical_input?(value, index)
  return false unless value.is_a?(String)

  match = INPUT.match(value)
  return false unless match

  basename = match[:basename]
  !!(basename && match[:index] == format("%04d", index) && usable_basename?(basename))
end

.canonical_table?(value) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
44
45
46
47
48
49
# File 'lib/ibex/verification_report/logical_path.rb', line 41

def canonical_table?(value)
  return false unless value.is_a?(String)

  match = TABLE.match(value)
  return false unless match

  basename = match[:basename]
  !!(basename && usable_basename?(basename))
end

.input(path, index) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/ibex/verification_report/logical_path.rb', line 16

def input(path, index)
  unless index.is_a?(Integer) && index.between?(0, MAX_INPUT_FILES - 1)
    raise ArgumentError, "verification reports support at most #{MAX_INPUT_FILES} input files"
  end

  "input/#{format('%04d', index)}/#{basename(path)}"
end

.table(path) ⇒ Object



25
26
27
# File 'lib/ibex/verification_report/logical_path.rb', line 25

def table(path)
  "table/#{basename(path)}"
end