Module: Dentaku

Defined in:
lib/dentaku.rb,
lib/dentaku/token.rb,
lib/dentaku/parser.rb,
lib/dentaku/ast/nil.rb,
lib/dentaku/version.rb,
lib/dentaku/ast/case.rb,
lib/dentaku/ast/node.rb,
lib/dentaku/ast/array.rb,
lib/dentaku/flat_hash.rb,
lib/dentaku/tokenizer.rb,
lib/dentaku/ast/access.rb,
lib/dentaku/ast/string.rb,
lib/dentaku/calculator.rb,
lib/dentaku/exceptions.rb,
lib/dentaku/ast/bitwise.rb,
lib/dentaku/ast/literal.rb,
lib/dentaku/ast/logical.rb,
lib/dentaku/ast/numeric.rb,
lib/dentaku/ast/datetime.rb,
lib/dentaku/ast/function.rb,
lib/dentaku/ast/grouping.rb,
lib/dentaku/ast/negation.rb,
lib/dentaku/ast/operation.rb,
lib/dentaku/string_casing.rb,
lib/dentaku/token_matcher.rb,
lib/dentaku/token_scanner.rb,
lib/dentaku/ast/arithmetic.rb,
lib/dentaku/ast/identifier.rb,
lib/dentaku/token_matchers.rb,
lib/dentaku/ast/combinators.rb,
lib/dentaku/ast/comparators.rb,
lib/dentaku/date_arithmetic.rb,
lib/dentaku/ast/functions/if.rb,
lib/dentaku/ast/case/case_else.rb,
lib/dentaku/ast/case/case_then.rb,
lib/dentaku/ast/case/case_when.rb,
lib/dentaku/ast/functions/count.rb,
lib/dentaku/dependency_resolver.rb,
lib/dentaku/ast/function_registry.rb,
lib/dentaku/ast/functions/duration.rb,
lib/dentaku/bulk_expression_solver.rb,
lib/dentaku/ast/case/case_conditional.rb,
lib/dentaku/ast/case/case_switch_variable.rb,
lib/dentaku/ast/functions/string_functions.rb

Defined Under Namespace

Modules: AST, StringCasing, TokenMatchers Classes: ArgumentError, BulkExpressionSolver, Calculator, DateArithmetic, DependencyResolver, Error, FlatHash, NodeError, ParseError, Parser, Token, TokenMatcher, TokenScanner, Tokenizer, TokenizerError, UnboundVariableError, ZeroDivisionError

Constant Summary collapse

VERSION =
"3.3.4"

Class Method Summary collapse

Class Method Details

.aliasesObject



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

def self.aliases
  @aliases
end

.aliases=(hash) ⇒ Object



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

def self.aliases=(hash)
  @aliases = hash
end

.cache_ast?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/dentaku.rb', line 27

def self.cache_ast?
  @enable_ast_caching
end

.cache_dependency_order?Boolean

Returns:

  • (Boolean)


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

def self.cache_dependency_order?
  @enable_dependency_order_caching
end

.calculatorObject



47
48
49
# File 'lib/dentaku.rb', line 47

def self.calculator
  @calculator ||= Dentaku::Calculator.new
end

.enable_ast_cache!Object



23
24
25
# File 'lib/dentaku.rb', line 23

def self.enable_ast_cache!
  @enable_ast_caching = true
end

.enable_caching!Object



18
19
20
21
# File 'lib/dentaku.rb', line 18

def self.enable_caching!
  enable_ast_cache!
  enable_dependency_order_cache!
end

.enable_dependency_order_cache!Object



31
32
33
# File 'lib/dentaku.rb', line 31

def self.enable_dependency_order_cache!
  @enable_dependency_order_caching = true
end

.evaluate(expression, data = {}) ⇒ Object



10
11
12
# File 'lib/dentaku.rb', line 10

def self.evaluate(expression, data = {})
  calculator.evaluate(expression, data)
end

.evaluate!(expression, data = {}) ⇒ Object



14
15
16
# File 'lib/dentaku.rb', line 14

def self.evaluate!(expression, data = {})
  calculator.evaluate!(expression, data)
end