Skip to content

Commit

Permalink
Change the behavior of STRING.to_ary
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroSteiner committed Jul 8, 2023
1 parent 907c8d8 commit 34356c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions docs/source/change_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,23 @@ Change Log
This document contains notes on the major changes for each version of the Rule Engine. In comparison to the git log,
this list is curated by the development team for note worthy changes.

Version 4.x.x
-------------

Version 4.0.0
^^^^^^^^^^^^^

*In Progress*

* **Breaking:** Changed ``STRING.to_ary`` to return an array of characters instead of splitting the string
* Use the new builtin ``$split`` function to split a string on whitespace into an array of words

Version 3.x.x
-------------

Version 3.6.0
^^^^^^^^^^^^^

Released :release:`3.6.0` on June 16th, 2023

* Removed testing for Python 3.4 and 3.5 on GitHub Actions
Expand Down
2 changes: 1 addition & 1 deletion lib/rule_engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def string_as_upper(self, value):

@attribute('to_ary', ast.DataType.STRING, result_type=ast.DataType.ARRAY(ast.DataType.STRING))
def string_to_ary(self, value):
return value.split()
return tuple(value)

@attribute('to_flt', ast.DataType.STRING, result_type=ast.DataType.FLOAT)
def string_to_flt(self, value):
Expand Down
2 changes: 1 addition & 1 deletion tests/ast/expression/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_ast_expression_string_attributes(self):
attributes = {
'as_lower': string.lower(),
'as_upper': string.upper(),
'to_ary': tuple(string.split()),
'to_ary': tuple(string),
'to_set': set(string),
'length': len(string),
}
Expand Down

0 comments on commit 34356c9

Please sign in to comment.