implement buffer.rb