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.0.4"

Class Method Summary collapse

Class Method Details

.configObject



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

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

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

Yields:



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

def self.configure
  yield(config)
end

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

Raises:



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

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:



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

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