ClearMyBench
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Ruby basics (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Ruby basics
#4529
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
Dir.entries returns an array with all the entries within the specified directory.

Dir.foreach provides the same feature
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4530
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
Creating a Directory


The Dir.mkdir can be used to create directories:

Dir.mkdir("mynewdir"

We can also set permissions on a new directory
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4531
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
Deleting a Directory:

The Dir.delete can be used to delete a directory. The Dir.unlink and Dir.rmdir perform exactly the same function and are provided for convenience.

Dir.delete("testdir"
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4532
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
One of the IO class methods is IO.readlines.

This method returns the contents of the file line by line.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4533
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
The IO.foreach Method:

This method also returns output line by line.

The difference between the method foreach and the method readlines is that the method foreach is associated with a block.


However, unlike the method readlines, the method foreach does not return an array
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4534
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
Renaming and Deleting Files:


We can rename and delete files programmatically with Ruby with the rename and delete methods
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
get the latest posts directly to your desktop
logo footer   Copyright 2009 - 2013 HotRecruiter.Com - All Rights Reserved