U E D R , A S I H C RSS

Ruby/2011년스터디/세미나


1. RubyLanguage

RubyLanguage ,
  1. 란 무



  2. 만남


    • Hello World!

2. Ruby 문


    • tryRuby
    • irb
    • visual studio ironRuby
    • netbeans ruby
    • eclipse ruby
    • aptana ( )

  • Hello Ruby!
    • 는 무
      • 1- 2
      • 1
        -2

    • ?!

        • 1.0/0.0 -> infinity
        • 123.method
        • "문".method
      • nilClass
        • nilClass 는 nil, prototype .
        • , !
        • 내부 class
    • .



  • Ruby.new
  • 를 만들
    • 대문 !(러)

    • initialize
      • initialize. ( 디 )
        class Some
        def initialize
        # init variables
        end
      • end

      • (@)
    • def initialize
      @var # this is the way how declaring variable
      end

    • !

      • class Some
        def initialize
        # init variables
        end
      • end

        def Some.function
        # dynamic function declare
        end


    • class Some2 < Some
      def initialize
      # this is overriding
      end
      end


        • 부모 를 동면, ?
      • Some2.function2 # undefined method
        def Some.function2
        # new function
        end
        Some.function2 # works!
        • /메 ?
          • superclass

    • attr_reader/attr_writer

  • 를 만들! (루는 return문 돼)
    • 맨 마
    • 는 {} 대 def/end
    • 는 () 능!
    • 만들
      • while
      • do/while
      • for

    • 블럭
      • 블럭
        {| parameters| do something with parameters..}
        yield : get the block and run it

        a = 1, 2, 3, 4, 5
        a.each {|x| puts x+1} # bloack ?(maybe)



      • <- gets
      • <- puts, print

  • ( 듯)

  • ( ?)
    • if/else
    • rescue 만들

  • (능)
    • 만들
      UnitTest::

  • !


  • DeleteMe) ..

3. Ruby 만들

  • RRobots RubyLanguage Robocode
  • 만 tcl 문 CodeRace
    • Pair Programming : Pair를 밸런 림.
  • CodeRace
    • A마 B마 .
    • 배를 .
    • Step 1
      • 배를 B마 .

        • A마 B마 .


class Layton
  def initialize
    @location = 'A'
  end

  def crossRiver
    printLocation
    @location = 'B'
    print " -> "
    printLocation
    print "\n"
  end

  def printLocation
    print @location
  end
end

4.

  • Snowball Keyword()
    • Winner : ,
Keyword
Ruby를 . $_ .
? ?
ifelse 못 들
-> 무 많
(2) 는 불
irb irb .( NetBeans irb )
-> (@)
. 른 보 는대 or . -

5.

  • "" irb를 . irb를 눌 , 무 dll 떴는데 . Ctrl+C를 눌 떴는데 N 눌러 . irb보 는 말 . 1+2를 3 ( =>nil !). 루 는 #define 느낌. . 만, 는 만 . 면 노 . -
    • .. .. yield yield를 만 . 는 co-routine ~ 블 !! . 는데 만번 -
    • 는데 부는 -
  • if-else 밖 못 들 . 데 if . 본 C, C++, Java, JavaScript, Python 는데 말. "".. . 뇌... 많더. aptana... 루 만들만 루 . irb . Python Shell . "며 불 "는 말... . -
    • 를 들. RubyLanguage if . . 만 a b를 받 add(a, b)를 만들 . .

add(3,4) # => 7  (# RubyLanguage   )
add 3,4  # => 7 
. . 런데 add 메 3, 4, 7

add(3, add(4, 7))
? .

add 3, add 4, 7
런데 는 대 add 메 는 매 ? 불명 . -

  • Ruby . irb를 Ruby . c 딱딱 는 모 . lua wow . -
    • irb.. 명.rb ruby / ~ -
  • 는데 미루 . 루 ( 는) . 면 irb editor를 보는 방 보면 . -
    • RubyLanguage . 보보 EuclideanAlgorithm 더더 . Netbeans를 ~ 매 . -
  • . "방" . 마 는 부 만들 ....... . -
    • "방" - . . ... ( ). Martz :-) 루 뵈는(..) :) -
    • -

    1. RubyLanguage 는 방 디를 며 몇 . 런데 . 부. 데…T_T
    2. CodeRace 는데 . 냥 돌 는데 .
    3. CodeRace를 못 RubyLanguage . 냥 듣 모르는데 며 문 는 방 남는 보내 .
    4. CodeRace . -
  • 는 방 . 를 못 는데 마무리 부 -
  • Ruby를 . 만, . 메모리 리 부 . (1. , 2. 림 3. 명 메모리 ). { |x| ~~ } 보면 는 문 뿐만? . -
    • . { |x| ~~ } 블 만() 는 부 . -
    • ! !! -

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:27:56
Processing time 0.0493 sec