Data Attributes

The attribute operator (.) can be used to recursively resolve values from a compound native Python data type such as an object or dictionary. This can be used when the thing which the rule is evaluating has members with their own submembers. If the resolver function fails, the attribute will be checked to determine if it is a builtin attribute.

Builtin Attributes

The following attributes are builtin to the default Context object.

Attribute Name

Attribute Type

ARRAY Attributes

is_empty

BOOLEAN

length

FLOAT

to_ary

ARRAY

to_set

SET

DATETIME Attributes

date

DATETIME

day

FLOAT

hour

FLOAT

microsecond

FLOAT

millisecond

FLOAT

minute

FLOAT

month

FLOAT

second

FLOAT

to_epoch

FLOAT

weekday

STRING

year

FLOAT

zone_name

STRING

FLOAT Attributes 1

ceiling

FLOAT

floor

FLOAT

is_nan

BOOLEAN

to_flt

FLOAT

to_str

STRING

MAPPING Attributes

is_empty

BOOLEAN

keys

ARRAY

length

FLOAT

values

ARRAY

SET Attributes

is_empty

BOOLEAN

length

FLOAT

to_ary

ARRAY

to_set

SET

STRING Attributes

as_lower

STRING

as_upper

STRING

to_ary

ARRAY

to_flt

FLOAT

to_set

SET

to_str

STRING

to_int

FLOAT

is_empty

BOOLEAN

length

FLOAT

TIMEDELTA Attributes

days

FLOAT

seconds

FLOAT

microseconds

FLOAT

total_seconds

FLOAT

FLOAT Attributes 1

Due to the syntax of floating point literals, the attributes must be accessed using parenthesis. For example 3.14.to_str is invalid while (3.14).to_str is valid.