Class: XDry::InsertionPoint

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInsertionPoint

Returns a new instance of InsertionPoint.



8
9
10
# File 'lib/xdry/patching/insertion_points.rb', line 8

def initialize
  find!
end

Instance Attribute Details

#ipObject (readonly)

Returns the value of attribute ip.



6
7
8
# File 'lib/xdry/patching/insertion_points.rb', line 6

def ip
  @ip
end

#methodObject (readonly)

Returns the value of attribute method.



6
7
8
# File 'lib/xdry/patching/insertion_points.rb', line 6

def method
  @method
end

#nodeObject (readonly)

Returns the value of attribute node.



6
7
8
# File 'lib/xdry/patching/insertion_points.rb', line 6

def node
  @node
end

Instance Method Details

#found?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/xdry/patching/insertion_points.rb', line 17

def found?
  not @method.nil?
end

#insert(patcher, lines) ⇒ Object

Raises:

  • (StandardError)


12
13
14
15
# File 'lib/xdry/patching/insertion_points.rb', line 12

def insert patcher, lines
  raise StandardError, "#{self.class.name} has not been found but trying to insert" unless found?
  patcher.send(@method, @node.pos, wrap(lines), @indent)
end