U E D R , A S I H C RSS

Ruby/2011년스터디/세미나


1. RubyLanguage

RubyLanguage , 파트







    • 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


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.0908 sec