I don't have much more to say about it.

After had been working with Ruby I've found its modules model very flexible 
& convenient. The best one I have seen. And I took just the basics from it.
If you are not familiar to it I can describe some moments. But I think 
you'll easily get how does it work from 
source<https://github.com/printercu/coffee_classkit/blob/master/coffee_classkit.coffee>
 (most 
methods are less then 7 loc) 
(https://github.com/printercu/coffee_classkit/blob/master/coffee_classkit.coffee).

Just few words...

...about hooks. Classes has hooks: inherited, included, extended. They are 
class methods and runs after action was performed with an base class as an 
argument. It brings great potential.

...about mixins. Mixin is just a class one want to mix into other. `Extend` 
and `include` both take instance methods (from class.prototype) from mixin. 
The difference is that include mixes that methods into instance methods, 
but `extend` into class methods.

...about ActiveSupport::Concern. Briefly, it allows include & extend the 
same time, also tracking mixin's dependencies. Original 
docs<http://api.rubyonrails.org/classes/ActiveSupport/Concern.html>
 (http://api.rubyonrails.org/classes/ActiveSupport/Concern.html).

...about variables.
Class_instance variable is not inheritable class property.
Class variable takes one value for base class and all descendants.
Class attribute - inheritable but overridable property (usual thing 
available via prototype chain). But class objects has access to their 
constructor's value and also can override this.
There are good exemples in 
tests<https://github.com/printercu/coffee_classkit/blob/master/test/coffee_classkit_spec.coffee>
 
(https://github.com/printercu/coffee_classkit/blob/master/test/coffee_classkit_spec.coffee).

If you have questions I would like to answer them. For complex example you 
can take a look at this repo <https://github.com/printercu/costa>
 (https://github.com/printercu/costa).

среда, 21 августа 2013 г., 1:17:51 UTC+4 пользователь Rick Waldron написал:
>
>
>
>
> On Mon, Aug 19, 2013 at 7:28 PM, Bert Belder <[email protected]<javascript:>
> > wrote:
>
>> > What do you think about it?
>>
>> I think for your own safety you want to run now.
>>
>
> Aw, why?? I was hoping to learn more about this amazing discovery! Can you 
> imagine--the language can grew parts that no one knows about? Must be hell 
> for those unit tests...
>
> ;)
>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to