Method: Parser::Source::Buffer#raw_source=
- Defined in:
- lib/parser/source/buffer.rb
permalink #raw_source=(input) ⇒ String
Populate this buffer from a string without encoding autodetection.
185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/parser/source/buffer.rb', line 185 def raw_source=(input) if @source raise ArgumentError, 'Source::Buffer is immutable' end @source = input.gsub("\r\n".freeze, "\n".freeze).freeze if !@source.ascii_only? && @source.encoding != Encoding::UTF_32LE && @source.encoding != Encoding::BINARY @slice_source = @source.encode(Encoding::UTF_32LE) end end |