Method: VER::Text::Tag#kill

Defined in:
lib/ver/text/tag.rb

#killObject



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/ver/text/tag.rb', line 166

def kill
  indices = []

  chunks = ranges.map{|range|
    indices << range.first << range.last
    range.get
  }

  # A bit of duplication, but if we use copy here we have to iterate the
  # ranges again.
  buffer.with_register do |register|
    register.value = chunks.at(1) ? chunks : chunks.first
  end

  buffer.delete(*indices)
end