2012年6月5日火曜日

みなとRuby会議01 に参加してきました #minatork01

みなとRuby会議01
http://regional.rubykaigi.org/minato01

よろしくお願いします。 #minatork01  on Twitpic


きっかけ

ChefがRubyで書かれているので、使うには知っておく必要があるとずっと思っていました。
TDDBC横浜やアジャイルサムライ読書会 横浜道場で知り合った方が、スタッフをされていたので何かの縁だろうと思い、加えてテーマが「はじめの一歩」ということで参加いたしました。

ソーシャルコーディング

お題はあみだくじの方を選びました。
TDDBC横浜以来のペアプロでしたが、ずっとRubyのレシピブック片手に「Rubyで表現するにはどうしたらいいか」を話し合って進めてたので、交代するの忘れてました。
制限時間内に出来なかったので悔いが残りましたが、一歩づつ進められた実感がありました。

招待講演

Rubyには地域コミュニティが様々あって、それぞれに特徴があるとは知りませんでした。
Railsのいいところをあんなに熱く語れるくらい好きになれるなんて、素晴らしいと思います。
Enumerableは、課題の際にリファレンスでよく引っかかってました。
遅延評価は、関数型言語で聞いたことがありますが、そういったトレンドも取り込んでいく意欲的な言語なのだと感じました。

はじめの一歩

Rubyに初めて触れて、とても楽しい言語だなと感じました。
Fedora17リリースされて、Ruby1.9.3がレポジトリに登録されたのもちょうどいいタイミングでした。
Rubyといい出会いが出来たのが、一番の収穫でした。

最後に
前日にいろいろアドバイスを下さった@joker1007さん、
ペアプロでペアになっていただいた@dasman74さん、
みなとRuby会議を主催して下さったyokohama.rbの皆様
ありがとうございました。

帰ってから、課題続きをやってみました。
T1 = '| '
T2 = '|---'
width = 5
if ARGV[0] != nil
number = ARGV[0].to_i
if number > 52
number = 52
end
width = number
end
p 'player number is ' + width.to_s
max = width - 1
# header
array = ("A" .. "Z").to_a
size = array.size
header = " "
width.times.map{ |i| array[i % size] }.each_with_index{ |elem, index|
cell = ""
cell << elem
if (index / size) == 1
cell << "'"
else
cell << " "
end
if index < max
cell << " "
else
cell << " "
end
header << cell
}
p header
# body
height = 10
height.times{
line = " "
before = ""
max.times {
cell =""
if before == T2
cell = T1
else
cell = [T1, T2].sample
end
before = cell
line << cell
}
line << '| '
p line
}
# footer
footer = ""
point = Random.rand(width)
width.times{ |k|
if k == point
footer << "!!! "
else
footer << " "
end
}
p footer
view raw amida.rb hosted with ❤ by GitHub
"player number is 5"
" A B C D E "
" |---| | | | "
" |---| | | | "
" |---| | | | "
" |---| | |---| "
" |---| | |---| "
" |---| | | | "
" |---| | |---| "
" |---| | | | "
" | |---| |---| "
" |---| |---| | "
" !!! "
view raw gistfile1.txt hosted with ❤ by GitHub