/**!
 * RefleJSion
 * Copyright(c) 2013 Luciano Rasente <programando.soft@gmail.com>
 * MIT Licensed
 */

/**
 *	Reflection class.
 *
 *	@class Reflection
 *	@static
 */
var Reflection = Reflection || {};

/**
 *	Member scope.
 *
 *	@attribute memberScope
 *	@readOnly
 */
Reflection.memberScope = {
    PRIVATE: 1,
    PUBLIC: 2,
    PROTECTED: 3
};

/**
 *	Member type.
 *
 *	@attribute memberType
 *	@readOnly
 */
Reflection.memberType = {
    METHOD: 1,
    ATTRIBUTE: 2,
    CTOR: 3,
    SPECIAL: 4
};

/**
 *	Gets the type of an object.
 *
 *	@method getType
 *	@static
 *	@param {Object} obj Object.
 *	@return {String} Type name.
 */
Reflection.getType = function(obj) {
    return Object.prototype.toString.call(obj).slice(8, -1);
};

/**
 *	Gets the members of an object.
 *
 *	@method getMembers
 *	@static
 *	@param {Object} obj Object.
 *	@param {Number} [mTypes] Types.
 *	@param {Number} [mScopes] Scopes.
 *	@return {Array} Members.
 */
Reflection.getMembers = function(obj, mTypes, mScopes) {
    var is = function(a, b) {
        return (typeof a === 'undefined') || (a & b) == b;
    };

    var resul = [];

    for (var mName in obj){

        var scope;

        if(mName.indexOf("__") == 0) {
            scope = Reflection.memberScope.PRIVATE;
        }
        else if(mName.indexOf("_") == 0) {
            scope = Reflection.memberScope.PROTECTED;
        }
        else {
            scope = Reflection.memberScope.PUBLIC;
        }

        if(is(mScopes, scope)) {
            var member = obj[mName];
            var t = Reflection.getType(member);
            var mType;

            var special = (mName.indexOf("$") == 0);
			
            if(t == "Function") {
                if(special) {
                    mType = Reflection.memberType.SPECIAL;
                }
                else if(mName == "initialize") {
                    mType = Reflection.memberType.CTOR;
                }
                else {
                    mType = Reflection.memberType.METHOD;
                }
            }
            else {
                if(special) {
                    mType = Reflection.memberType.SPECIAL;
                }
                else {
                    mType = Reflection.memberType.ATTRIBUTE;
                }
            }

            if(is(mTypes, mType)) {
                resul.push(mName);
            }
        }
    }

    return resul;
};

//
//	Node.JS
//
if(typeof module !== 'undefined') {
	module.exports = {
		"Reflection": Reflection
	};
}
@@ -11,16 +11,61 @@
 fleJSion
+ v0.1%0A * https://github.com/lcnvdl/reflejsion
 %0A * Copy
@@ -97,37 +97,8 @@
 ente
- %3Cprogramando.soft@gmail.com%3E
 %0A * 
@@ -1164,16 +1164,29 @@
 in obj)%7B
+%0A%09%0A%09%09// Scope
 %0A%0A      
@@ -1513,24 +1513,38 @@
 , scope)) %7B%0A
+%09%09%09// Type%0A%09%09%0A
             
@@ -1701,92 +1701,29 @@
 %09%09%09%0A
-            if(t == %22Function%22) %7B%0A                if(special) %7B%0A                    
+%09%09%09if(special) %7B%0A%09%09%09%09
 mTyp
@@ -1749,32 +1749,37 @@
 erType.SPECIAL;%0A
+%09%09%09%7D%0A
                 
@@ -1766,37 +1766,58 @@
 %09%09%7D%0A            
-    %7D
+else if(t == %22Function%22) %7B
 %0A               
@@ -1809,37 +1809,32 @@
                 
-else 
 if(mName == %22ini
@@ -2055,158 +2055,12 @@
 e %7B%0A
-                if(special) %7B%0A                    mType = Reflection.memberType.SPECIAL;%0A                %7D%0A                else %7B%0A                    
+%09%09%09%09
 mTyp
@@ -2108,36 +2108,68 @@
         
-    %7D%0A            %7D%0A
+%7D%0A%0A%09%09%09// If all is OK, then add to %22resul%22 array%0A%09%09%09
 %0A       
@@ -2302,16 +2302,17 @@
 e.JS%0A//%0A
+%0A
 if(typeo

Version added, and code more commented.