-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
binary and unary are under choice_rule These are not children of Data so Data can reference the binary and unary classes
- Loading branch information
Showing
9 changed files
with
144 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module Floe | ||
class Workflow | ||
class ChoiceRule | ||
class Equals < Floe::Workflow::ChoiceRule | ||
def true?(context, input) | ||
lhs = variable_value(context, input) | ||
rhs = compare_value(context, input) | ||
valid?(lhs) && lhs == rhs | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module Floe | ||
class Workflow | ||
class ChoiceRule | ||
class GreaterThan < Floe::Workflow::ChoiceRule | ||
def true?(context, input) | ||
lhs = variable_value(context, input) | ||
rhs = compare_value(context, input) | ||
valid?(lhs) && lhs > rhs | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module Floe | ||
class Workflow | ||
class ChoiceRule | ||
class GreaterThanEquals < Floe::Workflow::ChoiceRule | ||
def true?(context, input) | ||
lhs = variable_value(context, input) | ||
rhs = compare_value(context, input) | ||
valid?(lhs) && lhs >= rhs | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module Floe | ||
class Workflow | ||
class ChoiceRule | ||
class LessThan < Floe::Workflow::ChoiceRule | ||
def true?(context, input) | ||
lhs = variable_value(context, input) | ||
rhs = compare_value(context, input) | ||
valid?(lhs) && lhs < rhs | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module Floe | ||
class Workflow | ||
class ChoiceRule | ||
class LessThanEquals < Floe::Workflow::ChoiceRule | ||
def true?(context, input) | ||
lhs = variable_value(context, input) | ||
rhs = compare_value(context, input) | ||
valid?(lhs) && lhs <= rhs | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module Floe | ||
class Workflow | ||
class ChoiceRule | ||
class Matches < Floe::Workflow::ChoiceRule | ||
def initialize(payload, *, **) | ||
super | ||
# Note: only StringMatches exists (so no Path option) | ||
# Since this is static, we're converting it up front | ||
@ref = Regexp.escape(@ref).gsub('\*', '.*?') | ||
end | ||
|
||
def true?(context, input) | ||
lhs = variable_value(context, input) | ||
valid?(lhs) && lhs.match?(ref) | ||
end | ||
end | ||
end | ||
end | ||
end |