Module: Ibex::VerificationReport::LogicalPath

Defined in:
lib/ibex/verification_report/logical_path.rb,
sig/ibex/verification_report/logical_path.rbs

Overview

Closed logical identities used by version 1 verification reports.

Constant Summary collapse

MAX_INPUT_FILES =

Signature:

  • Integer

Returns:

  • (Integer)
10_000
BASENAME =

Signature:

  • Regexp

Returns:

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

Signature:

  • Regexp

Returns:

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

Signature:

  • Regexp

Returns:

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.canonical_input?(value, index) ⇒ Boolean

RBS:

  • (Object? value, Integer index) -> bool

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

RBS:

  • (Object? value) -> bool

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

RBS:

  • (String path, Integer index) -> String



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

RBS:

  • (String path) -> String



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

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

Instance Method Details

#self?.basenameString

RBS:

  • (String path) -> String

Parameters:

  • path (String)

Returns:

  • (String)


28
# File 'sig/ibex/verification_report/logical_path.rbs', line 28

def self?.basename: (String path) -> String

#self?.canonical_input?Boolean

RBS:

  • (Object? value, Integer index) -> bool

Parameters:

  • value (Object, nil)
  • index (Integer)

Returns:

  • (Boolean)


22
# File 'sig/ibex/verification_report/logical_path.rbs', line 22

def self?.canonical_input?: (Object? value, Integer index) -> bool

#self?.canonical_table?Boolean

RBS:

  • (Object? value) -> bool

Parameters:

  • value (Object, nil)

Returns:

  • (Boolean)


25
# File 'sig/ibex/verification_report/logical_path.rbs', line 25

def self?.canonical_table?: (Object? value) -> bool

#self?.inputString

RBS:

  • (String path, Integer index) -> String

Parameters:

  • path (String)
  • index (Integer)

Returns:

  • (String)


16
# File 'sig/ibex/verification_report/logical_path.rbs', line 16

def self?.input: (String path, Integer index) -> String

#self?.tableString

RBS:

  • (String path) -> String

Parameters:

  • path (String)

Returns:

  • (String)


19
# File 'sig/ibex/verification_report/logical_path.rbs', line 19

def self?.table: (String path) -> String

#self?.usable_basename?Boolean

RBS:

  • (String value) -> bool

Parameters:

  • value (String)

Returns:

  • (Boolean)


31
# File 'sig/ibex/verification_report/logical_path.rbs', line 31

def self?.usable_basename?: (String value) -> bool