½»»¥Ê½ Ruby Shell irb
irb ÊÇ´ÓÃüÁîÐÐÔËÐеÄ
irb µÄÃüÁîÐÐÑ¡Ïժ×Ô¡¡Porgramming Ruby µÚ¶þ°æ£©
-f
½ûÖ¹¶ÁÈ¡~/.irbrc¡¡Suppress reading ~/.irbrc.
-m
Êýѧģʽ£¨Ö§³Ö·ÖÊýºÍ¾ØÕ󣩡¡Math mode (fraction and matrix support is available).
-d
ÉèÖÃ#DEBUGΪtrue(ͬruby -dÒ»Ñù)¡¡¡¡Set $DEBUG to true (same as ``ruby -d'').
-r load-module
ͬruby -r¡¡Same as ``ruby -r''.
--inspect
ʹÓÃObject#inspectÀ´¸ñʽ»¯Êä³ö£¨Ä¬ÈÏ·½Ê½£¬³ýÊýѧģʽÍ⣩¡¡Use ``inspect'' for output (the default, unless in math mode).
--noinspect
²»Ê¹ÓÃinspect½øÐÐÊä³ö¡¡Do not use inspect for output.
--readline
ʹÓÃReadlineÀ©Õ¹Ä£¿é¡¡Use Readline extension module.
--noreadline
²»Ê¹ÓÃReadlineÀ©Õ¹Ä£¿é¡¡Do not use Readline extension module.
--prompt prompt-mode
Çл»Ìáʾ·û¡£Ô¤¶¨ÒåµÄģʽ°üÀ¨£¨null,default,simple,xmpÒÔ¼°inf-ruby£©¡¡Switch prompt mode. Predefined prompt modes are ``default'', ``simple'', ``xmp'', and ``inf-ruby''.
--prompt-mode prompt-mode
Same as --prompt.
--inf-ruby-mode
ÉèÖÃirbÒÔEmacsµÄinf-ruby-modeģʽÔËÐУ¬¸ü¸ÄÌáʾ·û²¢·ÏÖ¹-readline¡¡Sets up irb to run in inf-ruby-mode under Emacs. Changes the prompt and suppresses --readline.
--simple-prompt
ʹÓüòµ¥µÄÌáʾ·û¡¡Simple prompt mode.
--noprompt
²»ÏÔʾÌáʾ·û¡¡Do not display a prompt.
--tracer
ÏÔʾÃüÁîÖ´Ðеĸú×Ù¡¡Display trace for execution of commands.
--back-trace-limit n
ÏÔʾ×î¶¥²¿ºÍβ²¿µÄnÏî»ØËÝÐÅÏ¢¡£Ä¬ÈÏֵΪ16¡¡Display backtrace information using the top n and last n entries. The default value is 16.
--irb_debug n
½«ÄÚ²¿µ÷ÊÔ¼¶±ðÉèÖÃΪn(Ö»¶ÔirbµÄ¿ª·¢ÓÐÓã©¡¡Set internal debug level to n (only for irb development).
-v, --version
ÏÔʾirbµÄ°æ±¾ºÅ¡¡Print the version of irb.
ÃüÁîÐпªÊ¼Ö´Ðкó£¬irbÏÔʾһ¸öÌáʾ·û²¢µÈ´ýÊäÈë¡£
ʹÓÃirbµÄĬÈÏÌáʾ·û£¬ËüÏÔʾµ±Ç°µÄ°ó¶¨¡¢Ëõ½ø£¨Ç¶Ì×£©¼¶±ðÒÔ¼°Ðкš£
È磺
C:\>irb
irb(main):001:0> elvuel="elvuel"
=> "elvuel"
irb(main):002:0> elvuel.class
=> String
¿ÉÒÔͨ¹ýexit »ò quit,»òÕßͨ¹ýÊäÈëÒ»¸öÎļþ½áÊø·ûºÅ£¨Èç¹ûûÓÐÉèÖÃIGNORE_EOFģʽ£©À´Í˳ö
Ïà¹ØÎĵµ£º
Ruby 101£º¶¯Ì¬±à³Ì
Written by Allen Lee
µ±method_missingµÄħ·¨Ê§Ð§Ê±……
ÔÚÉÏһƪÎÄÕÂÀÎÒÃÇͨ¹ýÖØÐ´HashÀàµÄmethod_missing·½·¨°ÑHash¶ÔÏóÄ£Äâ³ÉÄäÃû¶ÔÏ󣬵«ÊÇ£¬ÕâÖÖ×ö·¨ÓÐʱ»á²úÉúһЩĪÃûÆäÃîµÄÎÊÌ⣬¾Ù¸öÀý×Ó°É£¬¼ÙÈçÎÒ°Ñprocess·½·¨£¨ÍêÕûʵÏֲμûÉÏһƪÎÄÕ ......
ruby on rails°²×°mysqlÊý¾Ý¿â
1. ÏÂÔØmysqlÈí¼þ
http://www.mysql.cn/
mysqlÖÐÎĹٷ½ÍøÕ¾ÏÂÔØ°²×°Èí¼þ£¬Ñ¡Ôñ5.0
2. °²×°mysql£¬ÉèÖÃĬÈÏ×Ö·û¼¯Îªutf-8
3. ÏÂÔØmysql for rubyµÄÇý¶¯²¢°²×°
http://rubyforge.org/ËÑË÷mysql£¬ÕÒµ½mysql -win
µã»÷ÏÂÔØ£¬½øÈëÒ³Ãæ
http://rubyforge.org/frs/?group_id= ......
1.install ruby
download from http://www.ruby-lang.org/en/news/2009/12/07/ruby-1-9-1-p376-is-released/
2.install rails
ruby gem install rails --include-dependencies
3.install mysql
download from http://sourceforge.net
ruby gem install&nb ......
ÕÕÀý¿ÉÒÔÏÈ¿´¶Ë³ÌÐò
class Person
def initialize( name,age=18 )
@name = name
@age = age
@motherland = "China"
end
def talk
puts "my name is "+@name+", age is "+@age.to_s
&n ......
1. rubyÒѳÉΪ1.87
2. ±ØÐëÏȰ²×°°²×°¹âÅÌÀïµÄеÄxcode£¬ÔÚ"optional"Ŀ¼Àï
3. ¿ÉÄÜÐèÒªÖØÐ°²×°macport
http://trac.macports.org/wiki/Migration
4. »òÕßÉý¼¶macport
http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard
$ sudo port selfupdate
$ sudo port sync
$ sudo port upgrade --force insta ......