목차

1. 인트로 _ 18.02.15

  1. 이책은 오직 루비언어에대한책이다.레일즈나젬등의툴에대한반영은없다.

  2. 루비는 전형적인 객체지향 언어이다. C개발자나 자바 개발자는 비교적 쉽게 접근할 수있지만 쉬운 언어는 아니다

  3. 객체지향언어로도 쓰지만 함수지향언어로도 사용가능하다

  4. 신텍스는 표현 중심의언어이다(Expression Oriented)

  5. 메소드(Methods)

    • 기본적인 변수선언 방법
  6. 수학 함수도 사용가능
  7. @ 인스턴스 변수, @@ 는 클래스변수

    • The Ruby Programming Language

      global variables are prefixed with$, instance variables are prefixed with@, and class variables are prefixed with@@.

  8. ```ruby

    Determine US generation name based on birth Year

    Case expression tests ranges with ===

    generation = case birthyear

             when 1946..1963: "Baby Boomer"  
             when 1964..1976: "Generation X"  
             when 1978..2000: "Generation Y"  
             else nil  
             end
    

    A method to ask the user to confirm something

    def are_you_sure? #define a method. Note Question mark !
    while true #Loop until we explicitly return

     print "Are you sure? \[Y/N\]: "             \#ask the user a question  
     response = gets                          \#get her answer  
     case response                          \#Begin case conditional  
     when /^\[yY\]/                          \#If response begins with y or Y  
       return true                        \#Return true the method  
     when /^\[nN\]/, /^$/                    \#If response n/N or is empty  
       return false  
       end  
     end  
    

    end

```

  • Ruby official site

  • 1.2.5 Ruby Package Management with gem

    • 루비 패키지 메니지

      • gem list # List installed gems
        gem enviroment # Display RubyGems configuration information # Update a named gem
        gem update rails gem update # Update all installed gems
        gem update --system # Update RubyGems itself
        gem uninstall rails # Remove an installed gem
  • Ruby Library

[30pages end]

results matching ""

    No results matching ""