Ruby

Details Snippets BASH

Core

Definition

Ruby is an interpreted scriptinghigh-levelgeneral-purpose programing language. Like the guitar, it’s claimed that Ruby is an easy to learn and a hard one to master.

Elements

Ruby element: instruction for an execution. Start on a new line. Backslash at the end of a line indicate the continuation of an element, and semicolon (optional) emphasize the end of the element.

Ruby application: series of elements that will be executed by the Ruby interpreter.

Clarifications

Start

On the server (consult hosting provider) has to be: (a) enabled the use of the BASH command line, and (b) installed and accessible Ruby interpreter (installation on Windows).

Check the installed Ruby version with:
$ ruby -v

The newest release of Ruby today (20 Feb 2020): 2.7.0 (released: 25 Dec 2019), but, shared server user can use only accessible release, for example: Bluehost: 1.9.3!

Modes of Operation

First mode:

Start IRB (Interactive Ruby):
$ irb --simple-prompt
and type in code interactively.

Example 01: list of files in the current directory (element – command)

>> Dir.glob("*.*") 

Example 02: personalized greeting (element – method)

?> def say_goodnight(name)
?>   result = "Good night, " + name
?>   return result
>> end
>> puts say_goodnight("Andrej")
Good night, Andrej

Second mode:

Create in text processor the file_name.rb file (using Ruby) and then execute it:
$ ruby file_name.rb

Topics

Ruby Topics Links (to the tutorialspoint)

Ruby Basic

Home Overview Environment Setup Syntax Classes and Objects Variables Operators Comments IF…ELSE Loops Methods Blocks Modules Strings Arrays Hashes Date & Time Ranges Iterators File I/O Exceptions

Ruby Advanced

Object Oriented Regular Expressions Database Access Web Applications Sending Email Socket Programming Ruby/XML XSLT Web Services Tk Guide Ruby/LDAP Tutorial Multithreading Built-in Functions Predefined Variables Predefined Constants Associated Tools

Ruby Useful Resources

Quick Guide Useful Resources Discussion Ruby on Rails Tutorial

Ruby Selected Reading

UPSC IAS Exams Notes Developer’s Best Practices Questions and Answers Effective Resume Writing HR Interview Questions Computer Glossary Who is Who

Ruby Topics Overview

Sources

Useful links

Learn

(a) tutorialsStackify (tutorials overview) Ruby tutorialspoint javaTpoint codecademy (account) rubylearning
(b) ebooks: tryruby.org (lectures) RubyInTwentyMinutes LaunchSchool LearntoProgram

Practice

(a) documents: Ruby Ruby-Doc RubyGemsGuides yard
(b) tools: Stackify (tools ovierview) Toolbox AWS Cloud9 (cloud)
(c) best practice: sitepoint codementor developers medium GitHub

Selected Books (ebooks collected)

author, title, edition, pages, publisher, ISBN, Amazon: price, evaluation / reviewes, record date

  1. Thomas D., Hunt A., Fowler C.: Programming Ruby 1.9 & 2.0: The Pragmatic Programmers’ Guide, 4th. 888. Pragmatic Bookshelf, 2013. 1937785491. $32.99. 4.3 / 47. 2020 01 13.
  2. Cooper P.: Beginning Ruby: From Novice to Professional, 3rd. 492. Apress, 2016. 1484212797. $20.72. 3.6 / 7. 2020 01 13.
  3. Pine C.: Learn to Program, 2nd. 194. Pragmatic Bookshelf, 2009. 1934356360. $15.69. 4.1 / 103. 2020 01 13.
  4. Olsen R.: Eloquent Ruby, 1st. 442. Addison-Wesley, 2013. 0321584104. $31.99. 4.6 / 105. 2020 01 13.
  5. Metz S.: Practical Object Oriented Design in Ruby: An Agile Primer Using Ruby, 2nd. 288. Addison-Wesley, 2018. 0134456475. $22.98. 4.8 / 18. 2020 01 13.
  6. Perrotta P.: Metaprogramming Ruby: Program Like the Ruby Pros, 2nd. 280. Pragmatic Bookshelf, 2014. 1941222129. $153.10. 4.5 / 21. 2020 01 13.
  7. Shaughnessy P.: Ruby Under a Microscope: An Illustrated Guide to Ruby Internals, 1st. 362. No Starch Press, 2013. 1593275277. $29.99. 4.9 / 17. 2020 01 13.
  8. McGavren J.: Head First Ruby: A Brain-Friendly Guide, 1st. 572. O’Reilly Media, 2015. 1449372651. $35.99. 4.6 / 44. 2020 01 13.
  9. Fields J., Harvie S., Fowler M., Beck K.: Refactoring: Ruby Edition, 1st. 480. Addison-Wesley Professional, 2009. 0321984137. $45.82. 4.4 / 8. 2020 01 13.
  10. Fitzgerald M.: Ruby Pocket Reference: Instant Help for Ruby Programmers, 2nd. 224. O’Reilly Media, 2015. 1491926015. $10.78. 4.6 / 15. 2020 01 13.
  11. Flanagan D., Matsumoto Y.: The Ruby Programming Language: Everything You Need to Know, 1st. 446. O’Reilly Media, 2008. 0596516177. $25.49. 4.3 / 124. 2020 01 13.
  12. Fulton H., Arko A.: The Ruby Way: Solutions and Techniques in Ruby Programming, 3rd. 816. Addison-Wesley Professional, 2015. 0321714636. $32.99. 4.4 / 19. 2020 01 13.
  13. Black D. A., Leo III J. : The Well-Grounded Rubyist, 3rd. 584. Manning Publications, 2019. 1617295213. $42.62. 4.5 / 11. 2020 01 13.
  14. Olsen R.: Design Patterns in Ruby, 1st. 384. Addison-Wesley Professional, 2007. 0321490452. $51.42. 4.5 / 57. 2020 01 13.

Details Snippets BASH