Sha256: 0d6a582f18bf9134dfbcf6bc9672aa686e634de7a39545e7ccedf4588a5dd275

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

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

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

    @include: (obj) ->
        special = this::extendedProperties || []
        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

3 entries across 3 versions & 1 rubygems

Version Path
lanes-0.1.7 client/lanes/lib/ModuleSupport.coffee
lanes-0.1.6 client/lanes/lib/ModuleSupport.coffee
lanes-0.1.5 client/lanes/lib/ModuleSupport.coffee