5 Matching Annotations
- Nov 2022
-
docs.ruby-lang.org docs.ruby-lang.org
-
A SimpleDelegator instance can take advantage of the fact that SimpleDelegator is a subclass of Delegator to call super to have methods called on the object being delegated to. class SuperArray < SimpleDelegator def [](*args) super + 1 end end SuperArray.new([1])[0] #=> 2
-
- Jul 2022
-
-
delegate :name, :to => :department, :prefix => true, :allow_nil => true
-
- Feb 2022
- Mar 2021
-
github.com github.com
-
Using ::delegates works exactly like the Forwardable module in Ruby, with one bonus: It creates the accessors in a module, allowing you to override and call super in a user module or class.
-
- Feb 2021
-
github.com github.com
-
One of the main reasons to work with components is re-usability and portability, but also a delegation of responsibilities. Adding a component should be as easy as simply adding the component without having to know the inner workings (or markup) of this component. A consumer should only be aware of the properties, methods and events of a component. In order to style a child component one has to be aware of the markup as well, which violates this 'delegation of responsibility'-principle.
-