Suche senden
Hochladen
003 Ruby小觀念與小技巧Part2
•
2 gefällt mir
•
1,047 views
Bruce Li
Folgen
require, load, include的不同 yield語法 method的選擇性參數、不定數量參數與順序
Weniger lesen
Mehr lesen
Technologie
Diashow-Anzeige
Melden
Teilen
Diashow-Anzeige
Melden
Teilen
1 von 29
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
001 Ruby小觀念與小技巧
001 Ruby小觀念與小技巧
Bruce Li
Rails Code Club 2 @ Taipei
Rails Code Club 2 @ Taipei
Bruce Li
Rx tech ltr of agreement #32
Rx tech ltr of agreement #32
UFCW Local 7
011 優化時間分配的 app 跟心得
011 優化時間分配的 app 跟心得
Bruce Li
Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)
Bruce Li
Gosari osasungarriak
Gosari osasungarriak
Itziar Olaizola
007 Facebook Open Graph 相關開發簡單介紹 公開版
007 Facebook Open Graph 相關開發簡單介紹 公開版
Bruce Li
RSpec best practice - avoid using before and let
RSpec best practice - avoid using before and let
Bruce Li
Empfohlen
001 Ruby小觀念與小技巧
001 Ruby小觀念與小技巧
Bruce Li
Rails Code Club 2 @ Taipei
Rails Code Club 2 @ Taipei
Bruce Li
Rx tech ltr of agreement #32
Rx tech ltr of agreement #32
UFCW Local 7
011 優化時間分配的 app 跟心得
011 優化時間分配的 app 跟心得
Bruce Li
Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)
Bruce Li
Gosari osasungarriak
Gosari osasungarriak
Itziar Olaizola
007 Facebook Open Graph 相關開發簡單介紹 公開版
007 Facebook Open Graph 相關開發簡單介紹 公開版
Bruce Li
RSpec best practice - avoid using before and let
RSpec best practice - avoid using before and let
Bruce Li
Unlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxy
Bruce Li
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Bruce Li
Rails Code Club 3 @ Taipei
Rails Code Club 3 @ Taipei
Bruce Li
010 Better and Better 工程師就業兩年多的心得雜談
010 Better and Better 工程師就業兩年多的心得雜談
Bruce Li
009 增進效率的雜七雜八mac快速鍵與設定 part 2
009 增進效率的雜七雜八mac快速鍵與設定 part 2
Bruce Li
008 vim超基礎入門
008 vim超基礎入門
Bruce Li
006 實作小玩具功能:chrome desktop notification
006 實作小玩具功能:chrome desktop notification
Bruce Li
004 動機 單純的力量 讀書心得
004 動機 單純的力量 讀書心得
Bruce Li
002 增進效率的有的沒的快速鍵與設定
002 增進效率的有的沒的快速鍵與設定
Bruce Li
Weitere ähnliche Inhalte
Mehr von Bruce Li
Unlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxy
Bruce Li
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Bruce Li
Rails Code Club 3 @ Taipei
Rails Code Club 3 @ Taipei
Bruce Li
010 Better and Better 工程師就業兩年多的心得雜談
010 Better and Better 工程師就業兩年多的心得雜談
Bruce Li
009 增進效率的雜七雜八mac快速鍵與設定 part 2
009 增進效率的雜七雜八mac快速鍵與設定 part 2
Bruce Li
008 vim超基礎入門
008 vim超基礎入門
Bruce Li
006 實作小玩具功能:chrome desktop notification
006 實作小玩具功能:chrome desktop notification
Bruce Li
004 動機 單純的力量 讀書心得
004 動機 單純的力量 讀書心得
Bruce Li
002 增進效率的有的沒的快速鍵與設定
002 增進效率的有的沒的快速鍵與設定
Bruce Li
Mehr von Bruce Li
(9)
Unlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxy
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Rails Code Club 3 @ Taipei
Rails Code Club 3 @ Taipei
010 Better and Better 工程師就業兩年多的心得雜談
010 Better and Better 工程師就業兩年多的心得雜談
009 增進效率的雜七雜八mac快速鍵與設定 part 2
009 增進效率的雜七雜八mac快速鍵與設定 part 2
008 vim超基礎入門
008 vim超基礎入門
006 實作小玩具功能:chrome desktop notification
006 實作小玩具功能:chrome desktop notification
004 動機 單純的力量 讀書心得
004 動機 單純的力量 讀書心得
002 增進效率的有的沒的快速鍵與設定
002 增進效率的有的沒的快速鍵與設定
003 Ruby小觀念與小技巧Part2
1.
30分鐘技術分享
Ruby小觀念&技巧 Part 2 By Bruce Li 2012/04/19 雲端線上科技股份有限公司 12年4月21日星期六
2.
這次要講三個東西
• require, load, include • yield • method的參數 12年4月21日星期六
3.
require, load, include 12年4月21日星期六
4.
require vs. load 12年4月21日星期六
5.
require vs. load
跳 過 12年4月21日星期六
6.
require vs. load
跳 過 值都⼀一樣 12年4月21日星期六
7.
require vs. load
跳 過 值都⼀一樣 ⼀一 次 loa d了 又 12年4月21日星期六
8.
require vs. load
跳 過 值都⼀一樣 ⼀一 次 loa d了 又 值很可能不同 12年4月21日星期六
9.
關於require/load的參數
• require跟load都是吃字串 • load必須提供附檔名,require則可忽略 • 自己寫的檔案不指定目錄的話,都會掛 12年4月21日星期六
10.
解決相對目錄問題
指明絕對路徑 /Users/bruce/Desktop/../var.rb = /Users/bruce/var.rb /Users/bruce/Desktop/var.rb 12年4月21日星期六
11.
解決相對目錄問題
指明絕對路徑 12年4月21日星期六
12.
require vs. include
module跟class寫在同⼀一個檔案當然也是可以include的 這樣就不需先要require 12年4月21日星期六
13.
補充:這樣也是可以的 12年4月21日星期六
14.
include lib下的module (rails)
• rails 2的時候是可以直接include的 • rails 3的時候因為安全性考量, include前需要先require • require "authenticated_system" => require RailsRoot/lib/authenticated_system.rb 12年4月21日星期六
15.
module命名
名詞 形容詞 非強制,不過這樣還蠻有道理的 12年4月21日星期六
16.
yield 12年4月21日星期六
17.
用來測效能
=> 1.2011590003967285 12年4月21日星期六
18.
yield的參數 12年4月21日星期六
19.
yield的參數
2 4 6 12年4月21日星期六
20.
yield的參數
2 4 6 12年4月21日星期六
21.
method的參數 12年4月21日星期六
22.
選擇性參數/預設值 12年4月21日星期六
23.
不定數量參數 12年4月21日星期六
24.
不定數量參數 12年4月21日星期六
25.
類似的:hash 12年4月21日星期六
26.
混用的順序 12年4月21日星期六
27.
混用的順序 - hash
√ 省略{ }的hash要在固定參數之後 要不然就明確的指定 { } 12年4月21日星期六
28.
end 12年4月21日星期六
29.
廣告
雲端線上徵Rails/iOS/Android工程師中 ‣ inside job board 我的技術&生活雜事部落格 ‣ http://littlebmix.blogspot.com/ 學習成功部落格 ‣ http://ascend-er.blogspot.com/ 12年4月21日星期六
Jetzt herunterladen