Ruby Programs

Ruby Programs / examples: This section contains solved Ruby Programs/examples on various topics such as basic programs, conditions & control statement-based programs, looping programs, array & string programs, structure programs, function & package-based programs, etc. with examinations and outputs.

Ruby Programs Index

Ruby Basic Programs

Ruby if/else Programs

Ruby case Statement Programs

Ruby Looping Programs

Ruby Classes & Objects Programs

Ruby User-defined Functions Programs

Ruby Blocks Programs

Ruby Modules and Mixins Programs

Ruby Strings Programs

Ruby Arrays Programs

Ruby Constructors/Destructors, Inheritance Programs

Ruby Date and Time Programs

  1. Ruby program to get current date-time using inspect() method
  2. Ruby program to get the individual components of the current date-time
  3. Ruby program to get the current weekday
  4. Ruby program to get the current time zone
  5. Ruby program to get the current day of the year out of 365
  6. More Ruby Date and Time Programs ...

Ruby Set Programs

  1. Print the elements of a set in Ruby
  2. Find the length of a set in Ruby
  3. Check the presence of an element in the set in Ruby
  4. Join all the elements of two sets in Ruby
  5. Find the common elements from two sets in Ruby
  6. Find the difference between two sets in Ruby
  7. Merge two sets in Ruby
  8. Check whether the set is empty or not in Ruby
  9. Delete and replace an element from the set in Ruby
  10. More Ruby Set Programs ...

Ruby File Handling Programs

  1. Ruby program to create an empty file
  2. Ruby program to write text into the file
  3. Ruby program to read entire text from the existing file
  4. Ruby program to read lines from the existing file
  5. Ruby program to read the specified number of characters from the existing file
  6. More Ruby File Handling Programs ...

Ruby Threading Programs

  1. Ruby program to create a simple thread
  2. Ruby program to create multiple threads
  3. Ruby program to sleep thread execution for a specific time
  4. Ruby program to join multiple threads using each() method
  5. More Ruby Threading Programs ...

Ruby Hashes Programs

  1. Ruby program to create a hash collection
  2. Ruby program to get keys from a hash collection
  3. Ruby program to compare two hash collections using '==' operator
  4. How to check if a hash key exists in Ruby?
  5. How to add elements to a Hash in Ruby?
  6. More Ruby Hashes Programs ...

Ruby Directories Programs

  1. Ruby program to create a directory
  2. Ruby program to check a directory is exist or not
  3. Ruby program to print the current working directory
  4. Ruby program to remove a specified directory
  5. Ruby program to get the list the name of files in a specified directory
  6. More Ruby Directories Programs ...

Ruby Miscellaneous Programs

Comments and Discussions!

Load comments ↻

Copyright © 2024 All rights reserved.