Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

rubyÔÚwindows 7 cmd ÖÐÏÔʾ²ÊÉ«ÎÄ×Ö

ÏÈ·ÅÉÏÒ»¸öʵÀýµÄbatÎļþ,ÒªÇó¹ÜÀíÔ±ÌØȨÔËÐÐ:
@echo off
::CMDÀïÏÔʾ²ÊÉ«ÎÄ×Ö
chcp 437>nul&&graftabl 936>nul
if not exist CONFIG.NT copy %WinDir%\System32\CONFIG.NT CONFIG.NT
@cls
echo DEVICE=%WinDir%\System32\ANSI.SYS /x >%WinDir%\System32\CONFIG.NT
@echo.
command /cecho 
command /cecho hello world
command /cecho  µÇðÙȸ¥
@echo.
@echo.
command /cecho  °×ÈÕÒÀɽ¾¡£¬»ÆºÓÈ뺣Á÷¡£
@echo.
command /cecho  ÓûÇîǧÀïÄ¿£¬¸üÉÏÒ»²ãÂ¥¡£
@echo.
@echo.
@echo.
@echo.
command /cecho  Ͻ­Áê
@echo.
@echo.
command /cecho  ³¯´Ç°×µÛ²ÊÔƼ䣬ǧÀï½­ÁêÒ»ÈÕ»¹¡£
@echo.
command /cecho  Á½°¶Ô³ÉùÌ䲻ס£¬ÇáÖÛÒѹýÍòÖØɽ¡£
@echo.
@echo.
command /cecho  ¼ÌÐøÏÂÒ³
pause>nul
@cls
@echo.
@echo.
@echo.
command /cecho  ¹ØɽÔÂ
@echo.
@echo.
command /cecho  Ã÷Ô³öÌìɽ£¬²ÔãÔƺ£¼ä¡£
@echo.
command /cecho  ³¤·ç¼¸ÍòÀ´µ¶ÈÓñÃŹء£
@echo.
command /cecho  ººÏ°׵ǵÀ£¬ºú¿úÇຣÍå¡£
@echo.
command /cecho  ÓÉÀ´Õ÷Õ½µØ£¬²»¼ûÓÐÈË»¹¡£
@echo.
command /cecho  Êù¿ÍÍû±ßÉ«£¬Ë¼¹é¶à¿àÑÕ¡£
@echo.
command /cecho  ¸ßÂ¥µ±´ËÒ¹£¬Ì¾Ï¢Î´Ó¦ÏС£
@echo.
@echo.
pause>nul
copy CONFIG.NT %WinDir%\System32\CONFIG.NT
copy CONFIG.NT %WinDir%\System32\CONFIG.NT
del CONFIG.NT
exit
ruby´úÂëÈçÏÂ:
require 'highline/import'
def init_color
%x{echo off}
%x{chcp 437>nul&&graftabl 936>nul}
%x{if not exist CONFIG.NT copy %WinDir%\\system32\\CONFIG.NT CONFIG.NT}
%x{cls}
%x{echo DEVICE=%WinDir%\\system32\\ANSI.SYS /x >%WinDir%\\system32\\CONFIG.NT}
%x{echo on}
end
$Color = [:BOLD,:


Ïà¹ØÎĵµ£º

rubyºÃÏñÓÐÖ¸Õë°¡£¡£¡£¡

b = "123"
a = b
b.gsub!(/2/,"")
puts a
µÃµ½µÄ½á¹ûÊÇ13£¬·¢ÏÖÈç¹ûa = bµÄ»°Ã²ËÆÖ»ÊÇ°ÑbµÄÖ¸Õë¸øÁËa£¬µ«ÊÇÈç¹ûbµÄÖµ·¢ÉúÁ˱仯a²ÅÄÜ´ÓbÖжÀÁ¢³öÀ´¡£
Èç¹û°ÑÉÏÃæµÄ´úÂë¸Ä³É
b = "123"
a = "#{b}"
b.gsub!(/2/,"")
puts a
ÔòµÃµ½µÄ½á¹ûΪ123£¬ÕâÀïÊÇ°ÑbµÄÖµ¸øÁ ......

Ñ¡Ruby»¹ÊÇÑ¡Python

 
  ¡¡×î½ü£¬ÎÒÐèÒªÒ»ÖÖ¿ìËÙ¿ª·¢ÓïÑÔ£¬Ä¿Ç°ÖËÊÖ¿ÉÈȵĿìËÙ¿ª·¢ÓïÑÔ¾ÍÊÇPythonºÍRubyÁË¡£RubyºÍPython¶¼ÊǷdz£ÓÅÐãµÄ½Å±¾ÓïÑÔ£¬ËäÈ»ËûÃǵÄÉè¼ÆÕÜѧ¼¸ºõÍêÈ«²»Í¬£¬µ«ËûÃÇЧÂʲ¶à£¬Ó¦ÓÃÁìÓòÒ²²î¾à²»´ó£¬ËƺõÌìÉú¾ÍÊǾºÕù¶ÔÊÖ¡£µ½µ×Ñ¡ÄǸöÄØ?ÎÒ×öÁËһЩ¼òµ¥µÄ±È½Ï¡£  
   
  ¡¡¡¡ÎÒÃDZȽ ......

rubyµÄÀàÓëÄ£¿é£¨1£©

class Point
@x = 1
@y = 2
def initialize(x,y)
@x,@y = x,y
end
end 
´úÂëÖеÄ@x£¬@yΪʵÀý±äÁ¿£¬ÊµÀý±äÁ¿Ö»¶ÔselfµÄ»·¾³Æð×÷Óã¬Òò´ËinitializeÍâÃæµÄ@x=1£¬@y=2Ö»¶ÔÀà±¾ÉíÆð×÷Ó㬶ø·½·¨ÄÚ²¿£¬µÄ@x£¬@yÊǶԶÔÏóµÄʵÀýÆð×÷Óõġ£
class Point
include Enumerable
def initialize(x ......

rubyºÍMinGWµÄÒ»´ÎÈÚºÏ

ÎÒÃÇÔÚʹÓÃC±à³Ìʱ»áÓöµ½Ò»¸öÎÊÌ⣬±ÈÈçÍ·ÎļþµÄÒ»¸öº¯Êý°üº¬ÔÚÒ»¸ölibÖУ¬µ«ÊÇ
ÔÚʵ¼ÊÁ¬½ÓÖÐÎÒÃDz»ÖªµÀËüÔÚÄĸö¿âÖС£Ò²Ðí¿ÉÐеÄÒ»ÖÖ°ì·¨ÊÇÖ±½ÓÉÏÍø²éѯij¸ö
º¯ÊýµÄÒÀÀµÌõ¼þ£¬Õâ¶ÔÓÚ³£Óú¯ÊýÊÇûÎÊÌâµÄ£¡µ«ÊǶÔÓÚ¸´ÔÓ¶øÓÖȱÉÙÎĵµµÄµÚÈý·½
libÀ´Ëµ£¬ÎÞÒìÓÚ´óº£ÀÌÕë¡£
×Ô´Ëͨ¹ý2ÖÖ°ì·¨À´³¢ÊÔ½â¾öÕâ¸öÎÊÌ⣬ÎÒÃÇÏÈ¿´µÚÒ» ......

RUBYʵ¼ù—Êý¾Ý¿â¼òµ¥²Ù×÷

¿ª·¢»·¾³£º
Ruby:1.9.1
Rails:2.3.5
Rake:0.8.7
Rack:1.0.1
Mysql:5.0.9
Ruby-mysql:mysql-2.8.1-x86-mswin
IDE:RubyMine2.0.1
Êý¾Ý¿â×¼±¸£º
database:dbdevelopment
user:crystal
password:crystal
Ò»¡¢´´½¨RubyÏîÄ¿RorTest
¶þ¡¢ÐÞ¸Ädatabase.yml
ÕâÀïÖ»ÆôÓÃdevelopment»·¾³Êý¾Ý¿â£¬ÐÞ¸ÄÅäÖÃÎļþÈçÏ£º
dev ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ