SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Text ruby .rb file

    Where do you save the text file that converts to a ruby .rb file to run in the ruby interpreter?

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    Hailsham, UK
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A ruby .rb file is a text file. There's no special conversion that you need to do. Save your text file as whatever.rb and save it wherever you like. In the same directory, run ruby whatever.rb to have ruby interpret and execute it. If you are writing a larger program or writing a Rails application then there are some conventions to follow as to where to save your files.

  3. #3
    SitePoint Member eManiac's Avatar
    Join Date
    Dec 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is either a text file or a Ruby script ( not a self-converting file ). Save it wherever you want.

    Code:
    Linux:   ruby /home/user/programming/application.rb
    Windows: ruby C:\Development\application.rb

  4. #4
    SitePoint Zealot Bill Palmer's Avatar
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're on a Unix-like system (anything but Windows), you added the "magic" line to the top of your script (#!/usr/bin/env ruby), and the script is executable (chmod +x yourscript), you can also just run the script directly e.g. ./yourscript



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •