class Solargraph::Source::Updater
Updaters contain changes to be applied to a source. The source applies the update via the Source#synchronize
method.
Attributes
changes[R]
@return [Array<Change>]
filename[R]
@return [String]
version[R]
@return [Integer]
Public Class Methods
new(filename, version, changes)
click to toggle source
@param filename [String] The file to update. @param version [Integer] A version number associated with this update. @param changes [Array<Solargraph::Source::Change>] The changes.
# File lib/solargraph/source/updater.rb, line 21 def initialize filename, version, changes @filename = filename @version = version @changes = changes @input = nil @did_nullify = nil @output = nil end
Public Instance Methods
repair(text)
click to toggle source
@return [String]
# File lib/solargraph/source/updater.rb, line 46 def repair text changes.each do |ch| text = ch.repair(text) end text end
write(text, nullable = false)
click to toggle source
@param text [String] @param nullable [Boolean] @return [String]
# File lib/solargraph/source/updater.rb, line 33 def write text, nullable = false can_nullify = (nullable and changes.length == 1) return @output if @input == text and can_nullify == @did_nullify @input = text @output = text @did_nullify = can_nullify changes.each do |ch| @output = ch.write(@output, can_nullify) end @output end