Class: RBI::ScopeConflict
- Inherits:
-
Tree
- Object
- Node
- NodeWithComments
- Tree
- RBI::ScopeConflict
- Extended by:
- T::Sig
- Defined in:
- lib/rbi/rewriters/merge_trees.rb
Overview
A conflict between two scope headers
Is rendered as a merge conflict between ‘left` and` right` for scope definitions: ~~~rb <<<<<<< left class Foo
module Foo >>>>>>> right
def m1; end
end ~~~
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Attributes inherited from Tree
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
- #accept_printer(v) ⇒ Object
-
#initialize(left:, right:, left_name: "left", right_name: "right") ⇒ ScopeConflict
constructor
A new instance of ScopeConflict.
- #oneline? ⇒ Boolean
Methods inherited from Tree
#<<, #add_sig_templates!, #annotate!, #deannotate!, #empty?, #group_nodes!, #index, #merge, #nest_non_public_methods!, #nest_singleton_methods!, #sort_nodes!
Methods inherited from NodeWithComments
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #merge_with, #parent_conflict_tree, #parent_scope, #print, #print_blank_line_before, #replace, #string
Constructor Details
#initialize(left:, right:, left_name: "left", right_name: "right") ⇒ ScopeConflict
Returns a new instance of ScopeConflict.
631 632 633 634 635 636 637 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 631 def initialize(left:, right:, left_name: "left", right_name: "right") super() @left = left @right = right @left_name = left_name @right_name = right_name end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
621 622 623 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 621 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
621 622 623 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 621 def right @right end |
Instance Method Details
#accept_printer(v) ⇒ Object
640 641 642 643 644 645 646 647 648 649 650 651 652 653 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 640 def accept_printer(v) previous_node = v.previous_node v.printn if previous_node && (!previous_node.oneline? || !oneline?) v.printl("# #{loc}") if loc && v.print_locs v.visit_all(comments) v.printl("<<<<<<< #{@left_name}") left.print_header(v) v.printl("=======") right.print_header(v) v.printl(">>>>>>> #{@right_name}") left.print_body(v) end |
#oneline? ⇒ Boolean
656 657 658 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 656 def oneline? left.oneline? end |