サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
iPhone 16
thomasleecopeland.com
The first chapter of Understanding Computation does a whirlwind tour of Ruby programming - syntax, control structures, etc. One of the constructs the author calls out is the Struct class. I've always used it like this: Team = Struct.new(:players, :coach) class Team def slogan "A stitch in time saves nine" end end some_team = Team.new(some_players, some_coach) That is, I'd use the Struct constructo
Updates: Brian Hogan did a talk on "don't reinvent the wheel" at the 2010 Ruby Hoedown; he has more examples around FileUtils and Pathname and such. For example, replacing File.read(File.join(Rails.root, "config", "database.yml") with Rails.root.join("config", "database.yml").read. Bruce Williams notes that folks may not be aware of and thus neglect newer Ruby methods like Enumerable#each_with_obj
このページを最初にブックマークしてみませんか?
『Junior Developer ·』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く