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: Addition, BooleanLiteral, ClosedIntervalEnd, ClosedIntervalStart, Comparison, ComparisonOperator, Configuration, Conjunction, Context, ContextEntry, ContextEntryList, DateTimeLiteral, Disjunction, Division, EvaluationError, Exponentiation, FilterExpression, FormalParameter, FunctionDefinition, FunctionInvocation, IfExpression, InstanceOf, Interval, List, ListEntries, LiteralExpression, Multiplication, Name, Node, NullLiteral, NumericLiteral, OpenIntervalEnd, OpenIntervalStart, Parser, PositionalParameters, QualifiedName, QuantifiedExpression, SimpleExpressions, SimplePositiveUnaryTest, SimplePositiveUnaryTests, SimpleUnaryTests, StringLiteral, Subtraction, SyntaxError, UnaryOperator, UnaryTests

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.configObject



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

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

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

Yields:



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

def self.configure
  yield(config)
end

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

Raises:



23
24
25
26
27
# File 'lib/feel.rb', line 23

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:



29
30
31
32
33
# File 'lib/feel.rb', line 29

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