Method: Parser::Source::Buffer#read

Defined in:
lib/parser/source/buffer.rb

#readBuffer

Populate this buffer from correspondingly named file.

Examples:

Parser::Source::Buffer.new('foo/bar.rb').read

Returns:

Raises:

  • (ArgumentError)

    if already populated

[View source] [View on GitHub]

136
137
138
139
140
141
142
# File 'lib/parser/source/buffer.rb', line 136

def read
  File.open(@name, 'rb') do |io|
    self.source = io.read
  end

  self
end