NSDictionary(MBExpression) Category Reference
Declared in | MBExpressionExtensions.h |
---|
Overview
This NSDictionary
class category adds method for evaluating expressions
using values contained in an NSDictionary
.
– evaluateAsObject:
Takes the value associated with the receiver’s key
and attempts to
evaluate that value as an object expression.
- (nullable id)evaluateAsObject:(nonnull NSString *)key
Parameters
key |
The key in the receiving dictionary whose associated value should be evaluated as an expression. |
---|
Return Value
The result of evaluating the value associated with key
as
an expression.
Discussion
If the value associated with key
is not an NSString
, the value’s
description
method will be invoked to convert it into a string before it is
evaluated as an expression.
Equivalent to passing the value associated with key
as the parameter to
the [MBExpression asObject:]
method.
Declared In
MBExpressionExtensions.h
– evaluateAsObject:defaultValue:
Takes the value associated with the receiver’s key
and attempts to
evaluate that value as an object expression.
- (nullable id)evaluateAsObject:(nonnull NSString *)key defaultValue:(nullable id)def
Parameters
key |
The key in the receiving dictionary whose associated value should be evaluated as an expression. |
---|---|
def |
A default value to be returned if expression evaluation would
otherwise return |
Return Value
The result of evaluating the value associated with key
as
an expression, or def
if nil
would otherwise be returned.
Discussion
If the value associated with key
is not an NSString
, the value’s
description
method will be invoked to convert it into a string before it is
evaluated as an expression.
Equivalent to passing the value associated with key
as the parameter to
the [MBExpression asObject:defaultValue:]
method.
Declared In
MBExpressionExtensions.h
– evaluateAsString:
Takes the value associated with the receiver’s key
and attempts to
evaluate that value as a string expression.
- (nullable NSString *)evaluateAsString:(nonnull NSString *)key
Parameters
key |
The key in the receiving dictionary whose associated value should be evaluated as an expression. |
---|
Return Value
The result of evaluating the value associated with key
as
an expression.
Discussion
If the value associated with key
is not an NSString
, the value’s
description
method will be invoked to convert it into a string before it is
evaluated as an expression.
Equivalent to passing the value associated with key
as the parameter to
the [MBExpression asString:]
method.
Declared In
MBExpressionExtensions.h
– evaluateAsString:defaultValue:
Takes the value associated with the receiver’s key
and attempts to
evaluate that value as a string expression.
- (nullable NSString *)evaluateAsString:(nonnull NSString *)key defaultValue:(nullable NSString *)def
Parameters
key |
The key in the receiving dictionary whose associated value should be evaluated as an expression. |
---|---|
def |
A default value to be returned if expression evaluation would
otherwise return |
Return Value
The result of evaluating the value associated with key
as
an expression, or def
if nil
would otherwise be returned.
Discussion
If the value associated with key
is not an NSString
, the value’s
description
method will be invoked to convert it into a string before it is
evaluated as an expression.
Equivalent to passing the value associated with key
as the parameter to
the [MBExpression asString:defaultValue:]
method.
Declared In
MBExpressionExtensions.h
– evaluateAsNumber:
Takes the value associated with the receiver’s key
and attempts to
evaluate that value as a numeric expression.
- (nullable NSDecimalNumber *)evaluateAsNumber:(nonnull NSString *)key
Parameters
key |
The key in the receiving dictionary whose associated value should be evaluated as an expression. |
---|
Return Value
The result of evaluating the value associated with key
as
an expression.
Discussion
If the value associated with key
is not an NSString
, the value’s
description
method will be invoked to convert it into a string before it is
evaluated as an expression.
Equivalent to passing the value associated with key
as the parameter to
the [MBExpression asNumber:]
method.
Declared In
MBExpressionExtensions.h
– evaluateAsNumber:defaultValue:
Takes the value associated with the receiver’s key
and attempts to
evaluate that value as a numeric expression.
- (nullable NSDecimalNumber *)evaluateAsNumber:(nonnull NSString *)key defaultValue:(nullable NSDecimalNumber *)def
Parameters
key |
The key in the receiving dictionary whose associated value should be evaluated as an expression. |
---|---|
def |
A default value to be returned if expression evaluation would
otherwise return |
Return Value
The result of evaluating the value associated with key
as
an expression, or def
if nil
would otherwise be returned.
Discussion
If the value associated with key
is not an NSString
, the value’s
description
method will be invoked to convert it into a string before it is
evaluated as an expression.
Equivalent to passing the value associated with key
as the parameter to
the [MBExpression asNumber:defaultValue:]
method.
Declared In
MBExpressionExtensions.h
– evaluateAsBoolean:
Takes the value associated with the receiver’s key
and attempts to
evaluate that value as a boolean expression.
- (BOOL)evaluateAsBoolean:(nonnull NSString *)key
Parameters
key |
The key in the receiving dictionary whose associated value should be evaluated as an expression. |
---|
Return Value
The result of evaluating the value associated with key
as
an expression.
Discussion
If the value associated with key
is not an NSString
, the value’s
description
method will be invoked to convert it into a string before it is
evaluated as an expression.
Equivalent to passing the value associated with key
as the parameter to
the [MBExpression asBoolean:]
method.
Declared In
MBExpressionExtensions.h
– evaluateAsBoolean:defaultValue:
Takes the value associated with the receiver’s key
and attempts to
evaluate that value as a boolean expression.
- (BOOL)evaluateAsBoolean:(nonnull NSString *)key defaultValue:(BOOL)def
Parameters
key |
The key in the receiving dictionary whose associated value should be evaluated as an expression. |
---|---|
def |
A default value to be returned if expression evaluation would
otherwise return |
Return Value
The result of evaluating the value associated with key
as
an expression, or def
if nil
would otherwise be returned.
Discussion
If the value associated with key
is not an NSString
, the value’s
description
method will be invoked to convert it into a string before it is
evaluated as an expression.
Equivalent to passing the value associated with key
as the parameter to
the [MBExpression asBoolean:defaultValue:]
method.
Declared In
MBExpressionExtensions.h