Skip to content

Instantly share code, notes, and snippets.

@dieterplex
Created March 24, 2012 01:53
Show Gist options
  • Save dieterplex/2177444 to your computer and use it in GitHub Desktop.
Save dieterplex/2177444 to your computer and use it in GitHub Desktop.
OSSF 歡歡喜喜學 Ruby

歡歡喜喜學 Ruby

http://www.openfoundry.org/tw/activities/details/301-happy-learning-ruby day1: http://goo.gl/Gq8My day2: http://goo.gl/A96TI

http://www.ruby-lang.org/zh_TW http://tryruby.org https://github.com/styleguide/ruby

1.8.x, REE not support 1.9.x 開發中

  • MRI(Matz's Ruby Interpreter) => CRuby => Ruby
  • JRuby

安裝

distro

sudo apt-get install ruby1.9.1-full # or ruby1.9.1 sudo ln -s /usr/bin/ruby1.9.1 /usr/bin/ruby sudo ln -s /usr/bin/irb1.9.1 /usr/bin/irb

http://www.veebsbraindump.com/2010/08/supporting-multiple-ruby-versions-on-ubuntu-10-04-lucid/

RVM

http://beginrescueend.com/

#RVM install script sudo apt-get install curl bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

files placed at $HOME/.rvm

#active rvm . .rvm/scripts/rvm #list versions rvm list known #install specific version rvm install 1.9.2 rvm list rvm use 1.9.2 rvm alias create default 1.9.2

more

irb #interactive ri #查文件

ruby -e 'print "Hello Ruby!"' ruby -e 'puts "Hello Ruby!"'

range

inject {...}

inject(:+)

mixin

include Modules (Object include kernel module http://ruby-doc.org/core-1.9.3/Object.html http://ruby-doc.org/core-1.9.3/Kernel.html

dock typing

reponse_to? :open

GEM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment