Class: Ast::Merge::SourceRender::SynthesizedFragment

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

Overview

Provider- or profile-generated source that does not exist in a revision.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, reason:, producer:, metadata: {}) ⇒ SynthesizedFragment

Returns a new instance of SynthesizedFragment.

Parameters:

  • content: (String)
  • reason: (Symbol, String)
  • producer: (Symbol, String)
  • metadata: (Hash[untyped, untyped]) (defaults to: {})


42
43
44
45
46
47
# File 'lib/ast/merge/source_render/fragment.rb', line 42

def initialize(content:, reason:, producer:, metadata: {})
  @content = content.to_s.freeze
  @reason = normalized_identifier(reason, :reason)
  @producer = normalized_identifier(producer, :producer)
  @metadata = .to_h.freeze
end

Instance Attribute Details

#contentString (readonly)

Returns the value of attribute content.

Returns:

  • (String)


40
41
42
# File 'lib/ast/merge/source_render/fragment.rb', line 40

def content
  @content
end

#metadataHash[untyped, untyped] (readonly)

Returns the value of attribute metadata.

Returns:

  • (Hash[untyped, untyped])


40
41
42
# File 'lib/ast/merge/source_render/fragment.rb', line 40

def 
  @metadata
end

#producerSymbol (readonly)

Returns the value of attribute producer.

Returns:

  • (Symbol)


40
41
42
# File 'lib/ast/merge/source_render/fragment.rb', line 40

def producer
  @producer
end

#reasonSymbol (readonly)

Returns the value of attribute reason.

Returns:

  • (Symbol)


40
41
42
# File 'lib/ast/merge/source_render/fragment.rb', line 40

def reason
  @reason
end

Instance Method Details

#kind:synthesized

Returns:

  • (:synthesized)


49
50
51
# File 'lib/ast/merge/source_render/fragment.rb', line 49

def kind
  :synthesized
end