For emulating Ruby syntax (and convey the semantics) of opening and reading a file, consider this implicit class (Scala 2.10 and upper),
import java.io.Filedef open(filename: String) = new File(filename)implicit class RichFile(val file: File) extends AnyVal { def read = io.Source.fromFile(file).getLines.mkString("\n")}
In this way,
open("file.txt").read