ruby 소소한 tip
the simple way if check value is null object&.spouse&.name == object.spouse.name if object && object.spouse class 2, "name"=>"1"}, {"count"=>2, "hit"=>1, "name"=>"1"}, {"count"=>1, "hit"=>5, "name"=>"1"} ] # sort sorted_arr = arr.sort_by {|data| [data["count"], data["hit"]]} 결과 [{"count"=>1, "hit"=>5, "name"=>"1"}, {"count"=>2, "hit"=>1, "name"=>"1"}, {"count"=>2, "hit"=>2, "name"=>"1"}] it'..
Ruby
2023. 6. 20. 23:16
ruby에서 exception 처리
ruby 에서의 exception 처리 begin-rescue-else-ensure-end begin # 일반적인 코드 영역. exception 발생 시 rescue 로 넘어감 rescue A_ExceptionClass => a_var # A Exception 발생. 처리 rescue B_ExceptionClass => b_var # B Exception 발생. 처리 else # Exception이 raise 되지 않은 경우 ensure # Exception 발생 여부와 상관없이 무조건 실행됨 end
Ruby
2023. 6. 20. 22:54
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- ruby
- Git
- ASCII
- sort algorithm
- 실용주의
- querydsl
- Lombok
- ActiveAdmin
- effective-java
- Encoding
- 코테 log
- SQL 전문가 가이드
- 이펙티브자바
- IntelliJ
- gitignore
- 암호화
- 이벤트스토밍
- Java
- 메모리 릭
- aws
- 사고..
- Generic
- Spring-Boot
- WebClient
- SHA
- point
- fetchResults
- annotation
- TroubleShooting
- DesignSystem
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함