Class: XDry::BeforeSuperCallIP

Inherits:
InsertionPoint show all
Defined in:
lib/xdry/patching/insertion_points.rb

Instance Attribute Summary

Attributes inherited from InsertionPoint

#ip, #method, #node

Instance Method Summary collapse

Methods inherited from InsertionPoint

#found?, #insert

Constructor Details

#initialize(scope) ⇒ BeforeSuperCallIP

Returns a new instance of BeforeSuperCallIP.



104
105
106
107
# File 'lib/xdry/patching/insertion_points.rb', line 104

def initialize scope
  @scope = scope
  super()
end

Instance Method Details

#find!Object



109
110
111
112
113
114
115
116
# File 'lib/xdry/patching/insertion_points.rb', line 109

def find!
  child_node = @scope.children.find { |child| child.is_a? NSuperCall }
  if child_node.nil?
    indented_before @scope.ending_node
  else
    before child_node
  end
end