• Here Documents in strings
    Here documents are nothing but strings that are inherently multiline.
  • str=<<EOF
    Raghu is giving a presenation,
    he know ruby very well.
    EOF
  • Here documents can also be stacked into a method like
    def foobar(<<str1,<<str2,<<str3)
     This is a cool thing
     And this is great.
     str1
     This is the second cool thing
     and it is also great
     str2
     This is third cool thing
     and now its becoming hot
     str3
    end
  • String Compression:
    The zlib library provides means for compressing and decompressing strings and files mailt faster db access,to optimize the network or may be obscure
    the strings  so that they are not possibly readable
    The Deflate and Inflate classes have the methods defalte and inflate for ths purpose.The deflate takes parameter whch defines the quality of compression and speed
    BEST COMPRESSION-results in a smallest compressed string
    BEST SPEED- Compresse faster buts does not compress as much
    DEFAULT COMPRESSION-Provides a tradeoff between
  • -How does method invocation takes place in ruby on rails?
    For example: myobject.method
    -Ruby first searches for singleton methods of myobject
    -Then it defines the myobject class
    -Then the methods defined in the myobjects ancestors
    In case if the mymethod is not found,ruby seraches the default method called method_missing
  • - Methods without parenthesis are valid in ruby.
     For example: foobar a,b,c
  • -There are no boolean types in Ruby.Instead there is the TRuecalss and the Falseclass with its instance as true an false
  • -loop is not a keyword instead its a method defined into the kernel module
  • -what is the differenece .. and… in ranges?
    ..is inclusive of the upper bound and the … is not exclusove of the upper bound.ex5..10 will consider 10 but …will not consider 10
  • what kind of a scope does the intialize method of a class have?
    -The intialize method is always private
  • The methods ending with an ! mark are said to be destructive methods.These are said to destructive since these methods tend to modify the behaviour of the receiver i.e the receiver will not hold the values before it was applied to this method.
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • blogmarks
  • Book.mark.hu
  • co.mments
  • Technorati
  • YahooMyWeb
  • IndianPad
  • DZone