Class: Ast::Merge::SourceRender::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/ast/merge/source_render/result.rb,
sig/ast/merge.rbs

Overview

Immutable output and provenance from a render plan.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, line_records:, synthesized_fragments:, conflicts:, verification_input:) ⇒ Result

Returns a new instance of Result.

Parameters:

  • content: (String)
  • line_records: (Array[Hash[untyped, untyped]])
  • synthesized_fragments: (Array[Hash[untyped, untyped]])
  • conflicts: (Array[Hash[untyped, untyped]])
  • verification_input: (Hash[untyped, untyped])


10
11
12
13
14
15
16
17
# File 'lib/ast/merge/source_render/result.rb', line 10

def initialize(content:, line_records:, synthesized_fragments:, conflicts:, verification_input:)
  @content = content.freeze
  @line_records = line_records.freeze
  @synthesized_fragments = synthesized_fragments.freeze
  @conflicts = conflicts.freeze
  @verification_input = verification_input.freeze
  freeze
end

Instance Attribute Details

#conflictsArray[Hash[untyped, untyped]] (readonly)

Returns the value of attribute conflicts.

Returns:

  • (Array[Hash[untyped, untyped]])


8
9
10
# File 'lib/ast/merge/source_render/result.rb', line 8

def conflicts
  @conflicts
end

#contentString (readonly)

Returns the value of attribute content.

Returns:

  • (String)


8
9
10
# File 'lib/ast/merge/source_render/result.rb', line 8

def content
  @content
end

#line_recordsArray[Hash[untyped, untyped]] (readonly)

Returns the value of attribute line_records.

Returns:

  • (Array[Hash[untyped, untyped]])


8
9
10
# File 'lib/ast/merge/source_render/result.rb', line 8

def line_records
  @line_records
end

#synthesized_fragmentsArray[Hash[untyped, untyped]] (readonly)

Returns the value of attribute synthesized_fragments.

Returns:

  • (Array[Hash[untyped, untyped]])


8
9
10
# File 'lib/ast/merge/source_render/result.rb', line 8

def synthesized_fragments
  @synthesized_fragments
end

#verification_inputHash[untyped, untyped] (readonly)

Returns the value of attribute verification_input.

Returns:

  • (Hash[untyped, untyped])


8
9
10
# File 'lib/ast/merge/source_render/result.rb', line 8

def verification_input
  @verification_input
end

Instance Method Details

#conflicted?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/ast/merge/source_render/result.rb', line 19

def conflicted?
  !conflicts.empty?
end

#to_hHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


23
24
25
26
27
28
29
30
31
# File 'lib/ast/merge/source_render/result.rb', line 23

def to_h
  {
    content: content,
    line_records: line_records,
    synthesized_fragments: synthesized_fragments,
    conflicts: conflicts,
    verification_input: verification_input
  }
end