SlideShare ist ein Scribd-Unternehmen logo
1 von 10
9. 이 책을 넘어서


          이 재영



  이 문서는 나눔글꼴로 작성되었습니다. 설치하기
목차
1.   RubyGems
2.   네트워크
3.   데이터베이스
4.   이미지
5.   GUI
6.   Ruby의 Black Magic
1. RubyGems




Ruby의 버젂 관리 시스템
1. RubyGems
Ruby Gem 은 사실상 표준인 Ruby의 버젼관리 시스템이다.
Ruby의 Application 이나 Library를 갂단히 취득, 도입, 갱신, 삭제 할 수 있다.
1. RubyGems – (1) 주요 명령어
$ gem list
-> 설치가 완료된 gem을 리스트로 출력한다.
-r 옵션을 붙일 경우 설치가 가능한 모듞 gem 목록을 얻을 수 있다.

$ gem search –r [keyword]
패턴에 매칭하는 gem 을 검색한다. (-r 옵션은 상동)

$ gem install [keyword]
새로운 gem을 시스템에 도입한다. (시스템 관리자 권한이 필요함)

$ gem update
도입이 완료된 gem 을 모두 새로운 버젂으로 갱신한다.
1. RubyGems – (2) 네트워크
Ruby 라이브러리에는 각종 네트워크 프로토콜을 지원하는 클래스 라이브러리가 포함
되어 있다.

예를 들면 HTTP, SMTP, POP3, IMAP, FTP 등의 프로토콜이다.
게다가 보다 저수준의 처리를 하기 위한 socket 라이브러리도 존재한다.

가장 대표적인 예로 open-uri 라이브러리를 이용해서 www 리소스도 얻을 수 있다.
1. RubyGems – (3) 데이터베이스
RubyGems 에서 제공되는 ActiveRecord 라이브러리를 사용해서 데이터베이스에
접근 할 수 있다.

각 SQL 의 종류마다 매칭되는 여러가지 gem이 있으니 살펴보고 설치 해야 한다.

ActiveRecord 의 경우 SQLITE 에 매치된다.

Mysql 의 경우 mysql2 gem 을 설치하면 dramatically 한 성능 향상이 있다고
알려져 있다.
http://www.redmine.org/projects/redmine/wiki/RedmineInstall?ve
    rsion=146#Database
1. RubyGems – (4) 이미지, (5) GUI
이미지 처리를 위한 다양한 처리 라이브러리가 존재한다.
가장 대표적으로, 다른 언어들에서도 많이 사용되는 GD2 라이브러리가 있다.
라이브러리 마다 사용 방법이 다르기 때문에 하나만 언급하지는 않겠다.

GUI 를 위한 라이브러리도 많이 존재한다. 가장 대표적이고 표준인 tk 라이브러리
도 있으며, wxruby gem 을 이용해 wxWidgets 을 사용할 수 도 있다.
1. RubyGems – (6) Ruby의 Black Magic
Ruby 에는 Black Magic 이라고 불리는 위험한 영역이 있다.
코드의 가독성을 저하시키거나 보안 구멍을 생성할 수도, 성능을 떨어 뜨릴 수 도 있다.
그렇지만 위험을 감수할 정도로 매력적인 기능들이다.

** eval 계열
Eval 계열을 사용하면 문자열을 ruby 코드로 해석, 실행 할 수 있다.
code = ‚puts ‘hello’‛
eval(code) #=> ‚hello‛
1. RubyGems – (6) Ruby의 Black Magic
** method_missing
호출된 메소드에 수신자가 존재하지 않을 경우 Object#method_missing 이 호출
된다. 이 메소드는 디폴트로 NoMethodError 예외를 발생하도록 정의되어 있다.

필요에 따라 method_missing을 오버라이드 하면 실제로는 존재하지 않는 메소드
를 존재하는 것처럼 작동 시킬 수 있다.

Weitere ähnliche Inhalte

Empfohlen

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Ruby - 9th (루비 9장 이 책을 넘어서)

  • 1. 9. 이 책을 넘어서 이 재영 이 문서는 나눔글꼴로 작성되었습니다. 설치하기
  • 2. 목차 1. RubyGems 2. 네트워크 3. 데이터베이스 4. 이미지 5. GUI 6. Ruby의 Black Magic
  • 3. 1. RubyGems Ruby의 버젂 관리 시스템
  • 4. 1. RubyGems Ruby Gem 은 사실상 표준인 Ruby의 버젼관리 시스템이다. Ruby의 Application 이나 Library를 갂단히 취득, 도입, 갱신, 삭제 할 수 있다.
  • 5. 1. RubyGems – (1) 주요 명령어 $ gem list -> 설치가 완료된 gem을 리스트로 출력한다. -r 옵션을 붙일 경우 설치가 가능한 모듞 gem 목록을 얻을 수 있다. $ gem search –r [keyword] 패턴에 매칭하는 gem 을 검색한다. (-r 옵션은 상동) $ gem install [keyword] 새로운 gem을 시스템에 도입한다. (시스템 관리자 권한이 필요함) $ gem update 도입이 완료된 gem 을 모두 새로운 버젂으로 갱신한다.
  • 6. 1. RubyGems – (2) 네트워크 Ruby 라이브러리에는 각종 네트워크 프로토콜을 지원하는 클래스 라이브러리가 포함 되어 있다. 예를 들면 HTTP, SMTP, POP3, IMAP, FTP 등의 프로토콜이다. 게다가 보다 저수준의 처리를 하기 위한 socket 라이브러리도 존재한다. 가장 대표적인 예로 open-uri 라이브러리를 이용해서 www 리소스도 얻을 수 있다.
  • 7. 1. RubyGems – (3) 데이터베이스 RubyGems 에서 제공되는 ActiveRecord 라이브러리를 사용해서 데이터베이스에 접근 할 수 있다. 각 SQL 의 종류마다 매칭되는 여러가지 gem이 있으니 살펴보고 설치 해야 한다. ActiveRecord 의 경우 SQLITE 에 매치된다. Mysql 의 경우 mysql2 gem 을 설치하면 dramatically 한 성능 향상이 있다고 알려져 있다. http://www.redmine.org/projects/redmine/wiki/RedmineInstall?ve rsion=146#Database
  • 8. 1. RubyGems – (4) 이미지, (5) GUI 이미지 처리를 위한 다양한 처리 라이브러리가 존재한다. 가장 대표적으로, 다른 언어들에서도 많이 사용되는 GD2 라이브러리가 있다. 라이브러리 마다 사용 방법이 다르기 때문에 하나만 언급하지는 않겠다. GUI 를 위한 라이브러리도 많이 존재한다. 가장 대표적이고 표준인 tk 라이브러리 도 있으며, wxruby gem 을 이용해 wxWidgets 을 사용할 수 도 있다.
  • 9. 1. RubyGems – (6) Ruby의 Black Magic Ruby 에는 Black Magic 이라고 불리는 위험한 영역이 있다. 코드의 가독성을 저하시키거나 보안 구멍을 생성할 수도, 성능을 떨어 뜨릴 수 도 있다. 그렇지만 위험을 감수할 정도로 매력적인 기능들이다. ** eval 계열 Eval 계열을 사용하면 문자열을 ruby 코드로 해석, 실행 할 수 있다. code = ‚puts ‘hello’‛ eval(code) #=> ‚hello‛
  • 10. 1. RubyGems – (6) Ruby의 Black Magic ** method_missing 호출된 메소드에 수신자가 존재하지 않을 경우 Object#method_missing 이 호출 된다. 이 메소드는 디폴트로 NoMethodError 예외를 발생하도록 정의되어 있다. 필요에 따라 method_missing을 오버라이드 하면 실제로는 존재하지 않는 메소드 를 존재하는 것처럼 작동 시킬 수 있다.