2023-04-01から1ヶ月間の記事一覧
⭐️配列を並び替えるメソッド ①sort_byメソッドsortとの違いはより複雑な処理もsort_byメソッドを使って短時間で行える。 ②sortだと、Arrayの中のハッシュは比較できない。 p [{name: "d", age: 33}, {name: "c", age: 34}, {name: "b", age: 0}, {name: "a",…
TryRubyネタで、私がふと疑問に思ったところ。 class Blurb def content @content end def content=(x) @content = x end def time @time end def time=(x) @time = x end def mood @mood end def mood=(x) @mood = x end end blurb1 = Blurb.new p blurb1.c…