Skip to content

Aerial as3 config-alt #37

@cesaric

Description

@cesaric

I was thinking of an as3 compliment to config-alt.xml. How about something like:


public class Aerial
{
    public static const DEBUG_MODE:Boolean = true;
        
    public static const SERVER:Aerial = new Aerial("acme.com", "dev.acme.com");
    public static const SERVER_PROTOCOL:Aerial = new Aerial("https://", "http://");
    public static const SERVER_URL:String = SERVER_PROTOCOL + SERVER + "/server.php";
        
    public static const USE_ENCRYPTION:Boolean = false;

    private var _value:*;
    private var _altValue:*;
        
    public function Aerial(value:*, altValue:* = null)
    {
        _value = value;
        _altValue = altValue;
    }
        
    public function toString():String
    {
        return String(DEBUG_MODE && _altValue ? _altValue : _value);
    }
        
    public function valueOf():Object
    {
        return (DEBUG_MODE && _altValue ? _altValue : _value);
    }

}

It's a drop-in replacement for any existing projects that are only using string constants. Other types like Boolean will need to implement the 'valueOf()' to retrieve the proper type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions