afred / interloper Goto Github PK
View Code? Open in Web Editor NEWAdds before and after callback hooks to methods on plain old ruby objects.
Adds before and after callback hooks to methods on plain old ruby objects.
Done when README.md has examples of how to use .inherit_callbacks_before
and .inherit_callbacks_after
.
Background: this is happening when .inherit_callbacks_for :some_method
is called in a child class, but only one of the before
or after
callbacks is defined in the parent. This causes the child class to end up with a callback that is nil
.
Done when: child class can call inherit_callbacks_for :some_method
where only the before
(or after
) callback is defined in the parent, and it will inherit the defined callback without throwing a LocalJumpError: no block given
.
Callbacks are being called for anonymous subclasses generated with test_class_factory
method in our tests, but once we try to use non-anonymous classes, any callbacks defined on a subclass are not being called.
Done when: callbacks defined on a subclass are called, when the subclass and it's parent have actual constant names (i.e. are not anonymous).
One use case for this is when you want to log an error or warning under certain circumstances when a method is called, but you only want to log it on the first time, and not on every subsequent time.
This could be implemented either with a parmeter, or as a new class method...
# as a parameter
before(:foo, times: 1) do
# ...
end
# as a class method...
once_before(:foo) do
# ...
end
Done when: can run a callback just once for a given method call.
Done when:
@private
to methods that don't need to be doc'd (i think this is how it works anyway).A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.