This commit is contained in:
Dan Buch 2009-06-11 21:27:47 -04:00
commit 1c02f1f789
3 changed files with 56 additions and 0 deletions

19
fact.rb Normal file
View File

@ -0,0 +1,19 @@
# factorializer!
def fact(n)
if n == 0
return 1
else
return n * fact(n - 1)
end
end
def main()
puts fact(ARGV[0].to_i)
end
if __FILE__ == $0
main()
end

31
hello.rb Normal file
View File

@ -0,0 +1,31 @@
=begin
OMG this be my comment
=end
class Greeter
def initialize(name="World")
@name = name
end
def say_hi
puts "Hi #{@name}!"
end
def say_bye
puts "Bye #{@name}, y'all come back now."
end
end
def main
grt = Greeter.new("Fizzle")
grt.say_hi()
grt.say_bye()
end
if __FILE__ == $0
main()
end

6
pipes Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env ruby
puts `ls -l .`
puts 'we be in ' + `pwd`
puts system('hostname -a')