Ruby/Language Basics/load

Материал из

Перейти к: навигация, поиск

Test load command

//Put this in a.rb:
puts "Hello from a.rb"
//And put this in a file called b.rb:
load "a"
puts "Hello from b.rb"
load "a"
puts "Hello again from b.rb"
//Run with ruby b.rb

use load to load external source code files into your program.

//File: string_extensions
class String
  def vowels
load "string_extensions"
puts "This is a test".vowels.join("-")