Ruby → User Guide #28 - Ruby - Nuts and bolts
Ruby, ruby lesson, ruby уроки, user guide, руководство пользователя
This chapter addresses a few practical issues.
Statement delimiters
Some languages require some kind of punctuation, often a semicolon (
), to end each statement in a program. Ruby instead follows the convention used in shells like
- ;
and …
- sh
Ruby → User Guide #27 - Ruby - Object initialization
Ruby, ruby lesson, ruby уроки, user guide, руководство пользователя
Our Fruit class from the previous chapter had two instance variables, one to describe the kind of fruit and another to describe its condition. It was only after writing a custom
method for the class that we realized it …
- inspect
Ruby → User Guide #26 - Ruby - Accessors
Ruby, ruby lesson, ruby уроки, user guide, руководство пользователя
What is an accessor?
We briefly discussed instance variables in an earlier chapter, but haven't done much with them yet. An object's instance variables are its attributes, the things that distinguish it from other objects of the same class. It …
Ruby → User Guide #25 - Ruby - Exception processing: ensure
Ruby, ruby lesson, ruby уроки, user guide, руководство пользователя
There may be cleanup work that is necessary when a method finishes its work. Perhaps an open file should be closed, buffered data should be flushed, etc. If there were always only one exit point for each method, we could …
Ruby → User Guide #24 - Ruby - Exception processing: rescue
Ruby, ruby lesson, ruby уроки, user guide, руководство пользователя
An executing program can run into unexpected problems. A file that it wants to read might not exist; the disk might be full when it wants to save some data; the user may provide it with some unsuitable kind of …
Ruby → User Guide #23 - Ruby - Class constants
class, constants, Ruby, Ruby уроки, user guide, руководство пользователя
A constant has a name starting with an uppercase character. It should be assigned a value at most once. In the current implementation of ruby, reassignment of a constant generates a warning but not an error (the non-ANSI version of …
Ruby → User Guide #22 - Ruby - Local variables
local variables, Ruby, ruby lesson, ruby уроки, user guide, локальные переменные, руководство пользователя
A local variable has a name starting with a lower case letter or an underscore character (_). Local variables do not, like globals and instance variables, have the value nil before initialization:
- ruby> $foo
- nil
- ruby> @foo
- nil
- ruby> foo …
Ruby → User Guide #21 - Ruby - Instance variables
Instance variables, Ruby, ruby lesson, ruby уроки, user guide, переменные класса, руководство пользователя
An instance variable has a name beginning with @, and its scope is confined to whatever object self refers to. Two different objects, even if they belong to the same class, are allowed to have different values for their instance …
Ruby → User Guide #20 - Ruby - global variables
global variables, Ruby, ruby lesson, ruby уроки, user guide, глобальные переменные, руководство пользователя
A global variable has a name beginning with $. It can be referred to from anywhere in a program. Before initialization, a global variable has the special value nil.
- ruby> $foo
- nil
- ruby> $foo = 5
- 5
- ruby> $foo
- 5 …
Ruby → User Guide #19 - Ruby - variables
Ruby, ruby lesson, ruby уроки, user guide, variables, переменные, руководство пользователя
Ruby has three kinds of variables, one kind of constant and exactly two pseudo-variables. The variables and the constants have no type. While untyped variables have some drawbacks, they have many more advantages and fit well with ruby's quick and …
- Last comments
- AKApril 1, 2025, 11:41 a.m.Добрый день. В данный момент работаю над проектом, где необходимо выводить звук из программы в определенное аудиоустройство (колонки, наушники, виртуальный кабель и т.д). Пишу на Qt5.12.12 поско…
- VPMarch 9, 2025, 4:14 p.m.Здравствуйте! Я устанавливал Qt6 из исходников а также Qt Creator по отдельности. Все компоненты, связанные с разработкой для Android, установлены. Кроме одного... Когда пытаюсь скомпилиров…
- ИМNov. 22, 2024, 9:51 p.m.Добрый вечер Евгений! Я сделал себе авторизацию аналогичную вашей, все работает, кроме возврата к предидущей странице. Редеректит всегда на главную, хотя в логах сервера вижу запросы на правильн…
- Now discuss on the forum
- fFeb. 15, 2025, 1:46 p.m.Подскажите, пожалуйста! Как данный класс можно дополнить, чтобы созданные объекты можно было перемещать мышкой по сцене?
- Не запускается компьютер (точнее работает блок , но сам монитор вообще жесть)В общем я ничего с интернета не скачивала в последнее время. На компе никаких левых пр…
- Вопрос решен. Узнать QModelIndex элемента на который мы перетаскиваем другой элемент, можно с помощью функции indexAt(event->position().toPoint()) представления QTreeViev вызываемой в переопр…
- Спасибо большое за помощь и простите за то что отнял время своей невнимательностью.