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
#4523
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.
#4524
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.
#4525
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  
File Modes and Ownership

Use the chmod method with a mask to change the mode or permissions/access list of a file:
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4526
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 ftype method identifies the type of the file by returning one of the following: file, directory, characterSpecial, blockSpecial, fifo, link, socket, or unknown.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4527
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  
Directories in Ruby


All files are contained within various directories, and Ruby has no problem handling these too.

Whereas the File class handles files, directories are handled with the Dir class
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4528
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  
Navigating Through Directories

To change directory within a Ruby program, use Dir.chdir as follows.

This example changes the current directory to /usr/bin.

Dir.chdir("/usr/bin"
 
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