-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
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.