2018-05-11から1日間の記事一覧

Rubyのdefの後に何を書けるか調べる実験

実務では一切の役に立たないRuby雑学。 普通のdef まずは基本の書き方。 def foo puts "hello" end foo #=> "hello" class User def self.foo puts "foo" end class << self def bar puts "bar" end end end User.foo #=> "foo" User.bar #=> "bar" 特異クラ…