Add 'RubyFun/' from commit 'b01c6826131196ba58b5288a3182f2526c89c249'

git-subtree-dir: RubyFun
git-subtree-mainline: a04a502787
git-subtree-split: b01c682613
This commit is contained in:
Dan Buch
2013-01-09 23:50:14 -05:00
299 changed files with 25309 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
puts <<'BUS_SCHEDULES'
c:\napolean's documents\tomorrow's bus schedule.txt
c:\new documents\sam spade's bus schedule.txt
c:\bus schedules\the #9 bus schedule.txt
BUS_SCHEDULES

View File

@@ -0,0 +1,38 @@
puts <<GROCERY_LIST
Grocery list
------------
1. Salad mix.
2. Strawberries.*
3. Cereal.
4. Milk.*
* Organic
GROCERY_LIST
puts '
Categorized Grocery list
------------------------
'
puts 'Produce', '-------', <<PRODUCE, 'Dairy', '-----', <<DAIRY, '* Organic'
1. Strawberries*
2. Blueberries
PRODUCE
1. Yogurt
2. Milk*
3. Cottage Cheese
DAIRY
puts
puts 'Indented Grocery list',
'---------------------', <<-GROCERY_LIST
1. Salad mix.
2. Strawberries.
3. Cereal.
4. Milk.
GROCERY_LIST

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env ruby
puts 'Hello World'

View File

@@ -0,0 +1,2 @@
#!/bin/bash
ruby -e "puts 'Hello World'"

View File

@@ -0,0 +1,8 @@
name = 'Charlie Brown'
puts <<"QUIZ"
Student: #{name}
1.\tQuestion: What is 4+5?
\tAnswer: The sum of 4 and 5 is #{4+5}
QUIZ

View File

@@ -0,0 +1,19 @@
print "Enter name: "
name = gets.chomp
puts "Your name is #{name}"
adjective = "dusty"
puts %q{These runes are "#{adjective}," wouldn't you say?}
puts %Q{These runes are "#{adjective}," wouldn't you say?}
puts %Q{Math isn't exactly my "strong suit," what with 2 + 1 being #{2 + 2}}
puts %Q{
Perhaps a multiline alternate quoting is of your liking, #{name}?
One in which 'single' and "double" quotes are both safe without
#{adjective} quoting? Smashing!
}

View File

@@ -0,0 +1 @@
http://en.wikibooks.org/wiki/Ruby_Programming