Class: Toml::Merge::FileAnalysis::CommentAugmenter
- Inherits:
-
Object
- Object
- Toml::Merge::FileAnalysis::CommentAugmenter
- Defined in:
- lib/toml/merge/file_analysis.rb
Defined Under Namespace
Classes: OwnerRange
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) ⇒ CommentAugmenter
constructor
A new instance of CommentAugmenter.
Constructor Details
#initialize(analysis, owners: [], **details) ⇒ CommentAugmenter
Returns a new instance of CommentAugmenter.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/toml/merge/file_analysis.rb', line 20 def initialize(analysis, owners: [], **details) @analysis = analysis @owners = Array(owners) @delegate = Ast::Merge::Comment::Augmenter.new( lines: analysis.lines, comments: analysis.send(:tracked_comment_entries), owners: analysis.send(:augmenter_delegate_owners, @owners), style: :hash_comment, **details, ) @capability = analysis.send(:build_comment_capability, owner_count: @owners.size, **details) @attachments_by_owner = @owners.each_with_object({}) do |owner, result| result[owner] = analysis.(owner) end @preamble_region = @delegate.preamble_region @postlude_region = @delegate.postlude_region @orphan_regions = @delegate.orphan_regions end |
Instance Attribute Details
#attachments_by_owner ⇒ Object (readonly)
Returns the value of attribute attachments_by_owner.
18 19 20 |
# File 'lib/toml/merge/file_analysis.rb', line 18 def @attachments_by_owner end |
#capability ⇒ Object (readonly)
Returns the value of attribute capability.
18 19 20 |
# File 'lib/toml/merge/file_analysis.rb', line 18 def capability @capability end |
#orphan_regions ⇒ Object (readonly)
Returns the value of attribute orphan_regions.
18 19 20 |
# File 'lib/toml/merge/file_analysis.rb', line 18 def orphan_regions @orphan_regions end |
#postlude_region ⇒ Object (readonly)
Returns the value of attribute postlude_region.
18 19 20 |
# File 'lib/toml/merge/file_analysis.rb', line 18 def postlude_region @postlude_region end |
#preamble_region ⇒ Object (readonly)
Returns the value of attribute preamble_region.
18 19 20 |
# File 'lib/toml/merge/file_analysis.rb', line 18 def preamble_region @preamble_region end |
Instance Method Details
#attachment_for(owner) ⇒ Object
39 40 41 |
# File 'lib/toml/merge/file_analysis.rb', line 39 def (owner) @attachments_by_owner[owner] || @delegate.(owner) end |