Sha256: b6361034f608598d1f879973041f502c41f77d98fa0ac249092b47e53776abcf

Contents?: true

Size: 684 Bytes

Versions: 11

Compression:

Stored size: 684 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?(@)
        this

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lanes-0.7.0 client/lanes/lib/ModuleSupport.coffee
lanes-0.6.1 client/lanes/lib/ModuleSupport.coffee
lanes-0.6.0 client/lanes/lib/ModuleSupport.coffee
lanes-0.5.6 client/lanes/lib/ModuleSupport.coffee
lanes-0.5.5 client/lanes/lib/ModuleSupport.coffee
lanes-0.5.0 client/lanes/lib/ModuleSupport.coffee
lanes-0.4.0 client/lanes/lib/ModuleSupport.coffee
lanes-0.3.0 client/lanes/lib/ModuleSupport.coffee
lanes-0.1.9.5 client/lanes/lib/ModuleSupport.coffee
lanes-0.1.9 client/lanes/lib/ModuleSupport.coffee
lanes-0.1.8 client/lanes/lib/ModuleSupport.coffee