Ruby Programming Language
Ruby Programming Language
block local variables (variables that are local to the block in which they are declared)
an additional lambda syntax: f = ->(a,b) { puts a + b }
an additional Hash literal syntax using colons for symbol
keys: {symbol_key: "value"} == {:symbol_key => "value"}
per-string character encodings are supported
new socket API (IPv6 support)
require_relative import security
Ruby 2
Ruby 2.0 was intended to be fully backward compatible with Ruby 1.9.3. As of the official 2.0.0
release on February 24, 2013, there were only five known (minor) incompatibilities.[31] Ruby 2.0
added several new features, including:
The ability to mark all string literals as frozen by default with a consequently large
performance increase in string operations.
Hash comparison to allow direct checking of key/value pairs instead of just keys.
A new safe navigation operator &. that can ease nil handling (e.g. instead
of if obj && obj.foo && obj.foo.bar , we can use if obj&.foo&.bar ).
The did_you_mean gem is now bundled by default and required on startup to automatically
suggest similar name matches on a NameError or NoMethodError.
Hash#dig and Array#dig to easily extract deeply nested values (e.g.
given profile = { social: { wikipedia: { name: 'Foo Baz' } } } , the value Foo Baz can now be
retrieved by profile.dig(:social, :wikipedia, :name) ).
.grep_v(regexp) which will match all negative examples of a given regular expression in
addition to other new features.
Ruby 2.4.0 includes performance improvements to hash table, Array#max, Array#min, and
instance variable access. Other notable changes include:
High-level - developer-friendly, with strong abstraction and use of natural or human language
constructs;
Dynamic - data types are determined at the stage of program execution. This increases the speed
of development;
Interpreted - Ruby code is processed by the interpreter at the time of execution without
preliminary compilation. This provides platform independence and reduces the size of executable
programs.
Matz introduced the language in 1995. Ruby has become popular with Japanese developers.
Already in the first versions of Ruby, there were distinctive features that have survived in the
language up to this day. These are object-oriented design, use of classes and inheritance, mixins,
iterators, closures, a garbage collector, exception handling. In the late 90s, Ruby documentation
and the English-language forum ruby-talk appeared in English. This made the language popular
outside of Japan. Matz says that he created Ruby to make developers happy. To understand what
we are talking about, you need to get acquainted with the features of this language.
*Printing
*Variables
*Casting and converting
*Strings *Numbers
*User Input
*Arrays
*N Dimensional Arrays
*Array Methods
* Methods
* If Else
* Switch Statements
* Dictionaries
* While Loops
* For Loops
* Exception Catching
* Constructors
* Getter and Setters
* Inheritance