Module: Binary::Merge

Defined in:
lib/binary/merge.rb,
lib/binary/merge/version.rb,
lib/binary/merge/provider.rb,
sig/binary/merge.rbs

Overview

Binary merge reports, diagnostics, and the opaque-document provider.

Defined Under Namespace

Modules: Version Classes: Provider

Constant Summary collapse

PACKAGE_NAME =

Returns:

  • (String)
'binary-merge'
VERSION =

Current gem version exposed at the traditional constant location.

Returns:

  • (String)
Version::VERSION

Class Method Summary collapse

Class Method Details

.binary_feature_profileObject



16
17
18
19
20
21
22
# File 'lib/binary/merge.rb', line 16

def binary_feature_profile
  {
    family: 'binary',
    supported_dialects: [],
    supported_policies: []
  }
end

.merge_providerProvider

Returns:



57
58
59
# File 'lib/binary/merge.rb', line 57

def merge_provider
  @merge_provider ||= Provider.new
end

.preservation_report(format:, schema:, matched_schema_paths:, preserved_ranges:) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/binary/merge.rb', line 44

def preservation_report(format:, schema:, matched_schema_paths:, preserved_ranges:)
  TreeHaver::BinaryMergeReport.new(
    format: format,
    schema: schema,
    matched_schema_paths: matched_schema_paths,
    preserved_ranges: preserved_ranges,
    rewritten_nodes: [],
    checksum_updates: [],
    nested_dispatches: [],
    diagnostics: []
  )
end

.register_provider!Hash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


61
62
63
# File 'lib/binary/merge.rb', line 61

def register_provider!
  Ast::Merge.register_provider(merge_provider, replace: true)
end

.render_policy(schema_path:, byte_range:, operation:, disposition:, reason:) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/binary/merge.rb', line 24

def render_policy(schema_path:, byte_range:, operation:, disposition:, reason:)
  TreeHaver::BinaryRenderPolicy.new(
    schema_path: schema_path,
    byte_range: byte_range,
    operation: operation,
    disposition: disposition,
    reason: reason
  )
end

.unsafe_diagnostic(schema_path:, byte_range:, message:, category: 'unsafe_binary_mutation') ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/binary/merge.rb', line 34

def unsafe_diagnostic(schema_path:, byte_range:, message:, category: 'unsafe_binary_mutation')
  TreeHaver::BinaryDiagnostic.new(
    severity: 'error',
    category: category,
    message: message,
    schema_path: schema_path,
    byte_range: byte_range
  )
end