Ruby → User Guide #18 - Ruby - procedure objects
procedure objects, Ruby, ruby lesson, ruby уроки, user guide, процедурные объекты, руководство пользователя
It is often desirable to be able to specify responses to unexpected events. As it turns out, this is most easily done if we can pass blocks of code as arguments to other methods, which means we want to be …
Ruby → User Guide #17 - Ruby - modules
modules, Ruby, ruby lesson, ruby уроки, user guide, модули, руководство пользователя
Modules in ruby are similar to classes, except:
- A module can have no instances.
- A module can have no subclasses.
- A module is defined by module ... end
Actually... the Module class of module is the superclass of the Class …
Ruby → User Guide #16 - Ruby - Singleton methods
method, Ruby, ruby lesson, ruby уроки, singleton, user guide, руководство пользователя
The behavior of an instance is determined by its class, but there may be times we know that a particular instance should have special behavior. In most languages, we must go to the trouble of defining another class, which would …
Ruby → User Guide #15 - Ruby - access control
access control, Ruby, ruby lesson, ruby уроки, user guide, контроль доступа, руководство пользователя
Earlier, we said that ruby has no functions, only methods. However there is more than one kind of method. In this chapter we introduce access controls .
Consider what happens when we define a method in the "top level", not …
Ruby → User Guide #14 - Ruby - Redefinition of methods
Ruby, ruby lesson, ruby уроки, user guide, переопределение методов, руководство пользователя
In a subclass, we can change the behavior of the instances by redefining superclass methods.
- ruby> class Human
- | def identify
- | print "I'm a person.\n"
- | end
- | def train_toll(age)
- | if age < 12
- | print "Reduced fare.\n"; …
Ruby → User Guide #13 - Ruby - Inheritance
Inheritance, Ruby, ruby lesson, ruby уроки, user guide, наследование, руководство пользователя
Our classification of objects in everyday life is naturally hierarchical. We know that all cats are mammals , and all mammals are animals . Smaller classes inherit characteristics from the larger classes to which they belong. If all mammals breathe, …
Ruby → User Guide #12 - Ruby - classes
class, Ruby, ruby lesson, ruby уроки, user guide, класс, руководство пользователя
The real world is filled by objects, and we can classify them. For example, a very small child is likely to say "bow-wow" when seeing a dog, regardless of the breed; we naturally see the world in terms of these …
Ruby → User Guide #11 - Ruby - methods
methods, Ruby, ruby lesson, ruby уроки, user guide, методы, руководство пользователя
What is a method? In OO programming, we don't think of operating on data directly from outside an object; rather, objects have some understanding of how to operate on themselves (when asked nicely to do so). You might say we …
Ruby → User Guide #10 - Ruby - Object-oriented thinking
Ruby, ruby lesson, ruby уроки, user guide, ооп, руководство пользователя
Object oriented is a catchy phrase. To call anything object oriented can make you sound pretty smart. Ruby claims to be an object oriented scripting language; but what exactly does "object oriented" mean?
There have been a variety of answers …
Ruby → User Guide #09 - Ruby - iterators
interators, Ruby, ruby lesson, ruby уроки, user guide, итераторы, руководство пользователя
Iterators are not an original concept with ruby. They are in common use in object-oriented languages. They are also used in Lisp, though there they are not called iterators. However the concepet of iterator is an unfamiliar one for many …
- Last comments
- AKApril 1, 2025, 11:41 a.m.Добрый день. В данный момент работаю над проектом, где необходимо выводить звук из программы в определенное аудиоустройство (колонки, наушники, виртуальный кабель и т.д). Пишу на Qt5.12.12 поско…
- VPMarch 9, 2025, 4:14 p.m.Здравствуйте! Я устанавливал Qt6 из исходников а также Qt Creator по отдельности. Все компоненты, связанные с разработкой для Android, установлены. Кроме одного... Когда пытаюсь скомпилиров…
- Now discuss on the forum
- DTApril 14, 2025, 3:38 p.m.Всем привет! На Qt 6.8 MinGW пытаюсь сделать управление подключением WiFi из программы. Пока делаю поддержку Windows, но так же хочу в дальнейшем внедрить и поддержку Linux/MacOS. Для…
- fFeb. 15, 2025, 1:46 p.m.Подскажите, пожалуйста! Как данный класс можно дополнить, чтобы созданные объекты можно было перемещать мышкой по сцене?
- Не запускается компьютер (точнее работает блок , но сам монитор вообще жесть)В общем я ничего с интернета не скачивала в последнее время. На компе никаких левых пр…
- Вопрос решен. Узнать QModelIndex элемента на который мы перетаскиваем другой элемент, можно с помощью функции indexAt(event->position().toPoint()) представления QTreeViev вызываемой в переопр…