# 20210228(일)

## 2021-02-28

### 1. 학습 날짜

* 2021-02-28

### 2. 학습 시간

* 13:00 \~ 20:00

### 3. 학습 범위 및 주제

* 백본 view, model, collection
* 루비온레일즈

### 4. 학습 목표

* PR 수정 및 PR 확인

### 5. 학습 정리

* [루비 문자열 검사 - 정규표현식](https://simian114.gitbook.io/blog/undefined/rubyonrails/undefined-5)

### 6. 상세 학습 내용

* 루비 문자열 검사에 대해 학습하고 적용함.
* 애너그램을 체크해야했다. 애너그램은 철자 바꾸기 놀이라는 뜻을 가지고 있다.
* 우리는 guild 이름을 기반으로 이 anagram 의 valid 를 체크해야했다.
* 기본적인 anagram 은 있는 모든 문자를 순서를 바꿔서 새로운 무언가를 만들어 내지만 우리는 guild 의 name 을 기반으로 축소형 이름을 만드는 것이므로 모든 문자를 사용하지 않아도 된다.
* 가장 먼저 진행한 validation 은 문자열의 길이, 그리고 적절하지 않은 값이 있는지 확인하는 부분이었다.
  * 문자열 길이는 `return errors unless (2..5).include?(anagram.length)` 와 같은 방법으로 해결했다.
  * 적절하지 않은 값이 있는지 확인하는 부분은 정규표현식을 이용했다. \`return errors unless anagram.match(/^@\[A-Z]/) 처럼 하면 된다.
* 이후에는 간단한 알고리즘을 이용해서 valid 체크를했다.
  * 원리는 간단하다. 먼저 name 과 anagram 을 정렬하고 맨 앞에 있는 값들을 하나씩 체크하는것.
  * 다른 방법이 있을거같긴 하지만 이렇게 무식하게해도 문제가 될 여지가 전혀 없다 생각해서 이렇게함.

### 7. 오늘 학습 내용에 대한 개인적인 총평

* 흠... 빨리 끝내고 내가 원하는 대로 무언가를 만들어보고 싶다.&#x20;

### 8. 다음 학습 계획

* guild\_create 만들기


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://simian114.gitbook.io/blog/undefined-1/diary/2021/february/20210228.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
