Module: FEEL

Defined in:
lib/feel.rb,
lib/feel/nodes.rb,
lib/feel/parser.rb,
lib/feel/version.rb,
lib/feel/unary_tests.rb,
lib/feel/configuration.rb,
lib/feel/literal_expression.rb

Defined Under Namespace

Classes: AtLiteral, BacktickName, BooleanLiteral, ClosedIntervalEnd, ClosedIntervalStart, Comparison, ComparisonOperator, Configuration, Conjunction, Context, ContextEntry, ContextEntryList, DateTimeLiteral, Disjunction, EvaluationError, Exponentiation, FilterExpression, FormalParameter, FunctionDefinition, FunctionInvocation, IfExpression, InstanceOf, Interval, List, ListEntries, LiteralExpression, Name, Node, NullLiteral, NumericLiteral, OpenIntervalEnd, OpenIntervalStart, Parser, PositionalParameters, QualifiedName, QuantifiedExpression, SimpleExpressions, SimplePositiveUnaryTest, SimplePositiveUnaryTests, SimpleUnaryTests, StringLiteral, SyntaxError, UnaryOperator, UnaryTests

Constant Summary collapse

VERSION =
"0.4.1"

Class Method Summary collapse

Class Method Details

.configObject



39
40
41
# File 'lib/feel.rb', line 39

def self.config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



43
44
45
# File 'lib/feel.rb', line 43

def self.configure
  yield(config)
end

.evaluate(expression_text, variables: {}) ⇒ Object

Raises:



27
28
29
30
31
# File 'lib/feel.rb', line 27

def self.evaluate(expression_text, variables: {})
  literal_expression = FEEL::LiteralExpression.new(text: expression_text)
  raise SyntaxError, "Expression is not valid" unless literal_expression.valid?
  literal_expression.evaluate(variables)
end

.test(input, unary_tests_text, variables: {}) ⇒ Object

Raises:



33
34
35
36
37
# File 'lib/feel.rb', line 33

def self.test(input, unary_tests_text, variables: {})
  unary_tests = FEEL::UnaryTests.new(text: unary_tests_text)
  raise SyntaxError, "Unary tests are not valid" unless unary_tests.valid?
  unary_tests.test(input, variables)
end