Ruby Inspect

Logo

Ruby Inspect, a comprehensive review of the programming language Ruby

View the Project on GitHub yc015/Ruby-Inspect

Paradigms of Ruby: Object Oriented, Functional, Imperative.

1. Object Oriented:

According to Ruby’s official FAQ, Ruby is an Object-Oriented programming language [1]. Everything in Ruby is an object. Ruby supports a variety of Object Oriented features, such as classes, methods, objects, and inheritance. According to the Tutorial’s point for Ruby, we have access control over the class method [2]. There are three levels of access control, public, private, or protected. Ruby also supports overriding and overloading the class methods and overloading operators.

2. Functional:

There are also a number of functional paradigm features in Ruby. First, every method in Ruby can return only one object, and it always returns something (no void return) [3]. Ruby also supports the anonymous function through the lambda functions. According to the official documentation of Ruby [4], Ruby also supports pattern matching using the case/in expression. Ruby also supports currying using the proc class method curry, which returns a curried anonymous function that has only one argument [5]. Ruby also has higher order functions such as map and inject (which is equivalent to the fold).

3. Imperative:

Ruby is also imperative. The program in ruby is a sequence of statements that are executed in the specified order. The program in ruby can be written with loops, such as while loops and for loops [6]. We can do assignments in Ruby’s program and change the assigned value to the variable (change contents on the memory). Therefore, Ruby’s program contains the state, and the state of the Ruby program can be changed as the program runs [7].

References:
[1] https://www.ruby-lang.org/en/documentation/faq/1/ The Official Ruby FAQ
[2] https://www.tutorialspoint.com/ruby/ruby_object_oriented.htm Tutorial’s point for Ruby - Object Oriented
[3] http://ruby-for-beginners.rubymonstas.org/writing_methods/return_values.html Ruby for Beginners by Ruby Monstas
[4] https://docs.ruby-lang.org/en/3.0.0/doc/syntax/pattern_matching_rdoc.html Ruby 3.0.0 Official Documentation for pattern matching
[5] https://docs.ruby-lang.org/en/3.0.0/Method.html#method-i-curry Ruby 3.0.0 Official Documentation for curry method
[6] https://www.tutorialspoint.com/ruby/ruby_loops.htm Tutorial’s point for Ruby’s loops
[7] https://www.tutorialspoint.com/ruby/ruby_variables.htm Tutorial’s point for Ruby’s variables.