Sha256: 68c0e2faa2063757944fbed7275219bdef394e3927b34261923be47deab69ba8

Contents?: true

Size: 691 Bytes

Versions: 7

Compression:

Stored size: 691 Bytes

Contents

moduleKeywords = ['extended', 'included', 'initialize']

class Lanes.lib.ModuleSupport
    @includeInto: (klass)->
        _.extend(klass,this)

    @include: (obj) ->
        special = this::extended_properties || []
        if obj.initialize
            fn = @::initialize
            @::initialize = ->
                obj.initialize.apply(this, arguments)
                fn?.apply(this,arguments)

        for key, value of obj when key not in moduleKeywords
            # Assign properties to the prototype
            if key in special && @::[key]
                _.extend(@::[key], value)
            else
                @::[key] = value
        obj.included?.apply(@)
        this

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lanes-0.1.2 client/lanes/lib/ModuleSupport.coffee
lanes-0.1.0 client/lanes/lib/ModuleSupport.coffee
lanes-0.0.8 client/lanes/lib/ModuleSupport.coffee
lanes-0.0.5 client/lanes/lib/ModuleSupport.coffee
lanes-0.0.3 client/javascripts/lib/ModuleSupport.coffee
lanes-0.0.2 client/javascripts/lib/ModuleSupport.coffee
lanes-0.0.1 client/javascripts/lib/ModuleSupport.coffee