標籤:Ruby on Rails 是一個可以使你開發,部署,維護 web 應用程式變得簡單的架構。2015年10月程式設計語言熱門排行榜 Ruby進入TIOBE熱門排行榜前十,可見其流行程度如此之高。本文就幫你開啟Ruby on Rails Web開發的大門,助你進入Ruby on Rails的世界,感受不一樣的風景。Ruby on
標籤:1.RubyInstaller在RubyInstaller官網下載window版本安裝,地址:http://rubyinstaller.org/downloads/ 執行安裝程式,勾選Add Ruby executables to your PATH,安裝完成在cmd上測試ruby -v查看 注意安裝路徑中不要有空格,否則會影響rails的安裝 TIPS:如果在控制台(cmd)裡面輸入ruby
標籤:在一個ruby字串中包含表但是或者變數。想使用不同的值替換運算式或者變數 1 類似java 或者python的printf-style方式template = ‘Oceania has always been at war with %s.‘template % ‘Eurasia‘ # => "Oceania has always been at war with Eurasia."template % ‘Eastasia‘ # => "Oceania
標籤:# definefrench_string = "il \xc3\xa9tait une fois"long_string = <<EOFHere is a long stringWith many paragraphsEOFputs long_string.empty?puts long_string.include? "many"puts french_string + long_string# concatenatehash = { key1: "val1", key2:
標籤:Optional ArgumentsSet default arguments, when we don‘t need to call it, we can simply skip it.def new_game(name, year=nil, system=nil) { name: name, year: year, system: system }endgame = new_game("Street Figher II") Options Hash
標籤:%QThis is an alternative for double-quoted strings, when you have more quote characters in a string.Instead of putting backslashes in front of them, you can easily write:>> %Q(Joe said: "Frank said: "#{what_frank_said}"")=> "Joe said: