Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to open a file in Ruby?



How to open a file in Ruby?..

Answer / Janpriya Gaur

To open a file in Ruby, you can use the File.open method. For example: File.open('filename.txt', 'r') { |file| file.each_line do |line| puts line end } This opens the file with read-only access and iterates through each line printing it.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Ruby Interview Questions

Tell us how would you implement hash in ruby internally?

1 Answers  


Tell me what is the difference between ruby 1.9 and ruby 2.0?

1 Answers  


Please explain the three levels of access control for ruby methods?

1 Answers  


Tell me how can you declare a block in ruby?

1 Answers  


Tell me how you can list all routes for an application?

1 Answers  


How to use ruby methods.

1 Answers  


Tell me how you can create a controller for subject?

1 Answers  


Explain about Float, Dig and Max?

1 Answers  


Tell us what is the difference between dynamic and static scaffolding?

1 Answers  


What is concatenating string in ruby. In how many ways you can create a concatenating string.

1 Answers  


difference between activesupport's “hashwithindifferentaccess” and ruby's “hash”?

1 Answers  


Explain Ruby module?

1 Answers  


Categories