Ruby

  Home  Computer Programming  Ruby


“Ruby Interview Questions and Answers will guide us now that Ruby is a dynamic, reflective, general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was initially developed. It is based on Perl, Smalltalk, Eiffel, Ada, and Lisp. So learn Ruby Programming Language by Ruby Interview Questions with Answers”



26 Ruby Questions And Answers

21⟩ What is the use of super in Ruby Rails?

► Ruby uses the super keyword to call the superclass implementation of the current method.

► Within the body of a method, calls to super acts just like a call to that original method.

► The search for a method body starts in the superclass of the object that was found to contain the original method.

def url=(addr)

super (addr.blank? || addr.starts_with?('http')) ? addr : http://#{addr}

end

 206 views

22⟩ Interpolation is a very important process in Ruby, comment.

► Interpolation is the process of inserting a string into a literal.

► You can interpolate a string into a literal by placing a Hash (#) within {} open and close brackets.

► This refers to a new name to by referring to the copy of the original method.

 183 views

23⟩ Describe the environment variables present in Ruby.

RUBYOPT

Additional command-line options to Ruby; examined after real command-line options are parsed ($SAFE must be 0).

RUBYLIB

Additional search path for Ruby programs ($SAFE must be 0).

RUBYPATH

With -S option, search path for Ruby programs (defaults to PATH).

RUBYSHELL

Shell to use when spawning a process; if not set, will also check SHELL or COMSPEC. DLN_LIBRARY_PATH Search path for dynamically loaded modules.

RUBYLIB_PREFIX

(Windows only) Mangle the RUBYLIB search path by adding this prefix to each component.

 201 views

24⟩ What is Rails?

► Ruby on Rails is an open source web application framework for the Ruby programming language.

► It is used with an Agile development methodology that is used by web developers for rapid development.

 170 views

25⟩ Describe class libraries in Ruby.

► The Ruby standard library extends the foundation of the Ruby built-in library with classes and abstractions for a variety of programming needs, including network programming, operating system services, threads, and more.

► These classes provide flexible capabilities at a high level of abstraction, giving you the ability to create powerful Ruby scripts useful in a variety of problem domains.

 184 views