Class: Prism::Merge::FileAnalysis::NativeCommentAugmenter
- Inherits:
-
Object
- Object
- Prism::Merge::FileAnalysis::NativeCommentAugmenter
- Defined in:
- lib/prism/merge/file_analysis.rb
Instance Attribute Summary collapse
-
#attachments_by_owner ⇒ Object
readonly
Returns the value of attribute attachments_by_owner.
-
#capability ⇒ Object
readonly
Returns the value of attribute capability.
-
#orphan_regions ⇒ Object
readonly
Returns the value of attribute orphan_regions.
-
#postlude_region ⇒ Object
readonly
Returns the value of attribute postlude_region.
-
#preamble_region ⇒ Object
readonly
Returns the value of attribute preamble_region.
Instance Method Summary collapse
- #attachment_for(owner) ⇒ Object
-
#initialize(analysis, owners: [], **details) ⇒ NativeCommentAugmenter
constructor
A new instance of NativeCommentAugmenter.
Constructor Details
#initialize(analysis, owners: [], **details) ⇒ NativeCommentAugmenter
Returns a new instance of NativeCommentAugmenter.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/prism/merge/file_analysis.rb', line 22 def initialize(analysis, owners: [], **details) @analysis = analysis @owners = Array(owners) @capability = Ast::Merge::Comment::Capability.native_full( source: :prism, style: :hash_comment, attachment_hints: true, comment_nodes: true, owner_count: @owners.size, comment_count: @analysis.tree.comments.size, **details ) @attachments_by_owner = {} @preamble_region = nil @postlude_region = nil @orphan_regions = [] build! end |
Instance Attribute Details
#attachments_by_owner ⇒ Object (readonly)
Returns the value of attribute attachments_by_owner.
20 21 22 |
# File 'lib/prism/merge/file_analysis.rb', line 20 def @attachments_by_owner end |
#capability ⇒ Object (readonly)
Returns the value of attribute capability.
20 21 22 |
# File 'lib/prism/merge/file_analysis.rb', line 20 def capability @capability end |
#orphan_regions ⇒ Object (readonly)
Returns the value of attribute orphan_regions.
20 21 22 |
# File 'lib/prism/merge/file_analysis.rb', line 20 def orphan_regions @orphan_regions end |
#postlude_region ⇒ Object (readonly)
Returns the value of attribute postlude_region.
20 21 22 |
# File 'lib/prism/merge/file_analysis.rb', line 20 def postlude_region @postlude_region end |
#preamble_region ⇒ Object (readonly)
Returns the value of attribute preamble_region.
20 21 22 |
# File 'lib/prism/merge/file_analysis.rb', line 20 def preamble_region @preamble_region end |
Instance Method Details
#attachment_for(owner) ⇒ Object
41 42 43 |
# File 'lib/prism/merge/file_analysis.rb', line 41 def (owner) @attachments_by_owner[owner] end |