~/

Entries from 2013-08-01 to 1 month

%i, %I

%w(foo bar baz).map(&:to_sym) can be written with %i from Ruby2.0 %i(foo bar baz) http://doc.ruby-lang.org/ja/2.0.0/doc/spec=2fliteral.html %i!STRING! : 要素がシンボルの配列(空白区切り) %I!STRING! : 要素がシンボルの配列(空白区切り)。式展開…

Destructuring assignments

These are Destructuring assignments. someObject = a: 'foo' b: 'bar' { a, b } = someObject console.log a # -> 'foo' console.log b # -> 'bar' class Foo constructor: (a) -> @a = a class Foo constructor: (@a) -> # is equivalant to above class …