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/functions/all.rb,
lib/dentaku/ast/functions/any.rb,
lib/dentaku/ast/functions/map.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/ast/functions/pluck.rb,
lib/dentaku/dependency_resolver.rb,
lib/dentaku/ast/functions/filter.rb,
lib/dentaku/ast/function_registry.rb,
lib/dentaku/ast/functions/duration.rb,
lib/dentaku/bulk_expression_solver.rb,
lib/dentaku/ast/functions/ruby_math.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.4.2"

Class Method Summary collapse

Class Method Details

.aliasesObject



50
51
52
# File 'lib/dentaku.rb', line 50

def self.aliases
  @aliases
end

.aliases=(hash) ⇒ Object



54
55
56
# File 'lib/dentaku.rb', line 54

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

.cache_ast?Boolean

Returns:

  • (Boolean)


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

def self.cache_ast?
  @enable_ast_caching
end

.cache_dependency_order?Boolean

Returns:

  • (Boolean)


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

def self.cache_dependency_order?
  @enable_dependency_order_caching
end

.cache_identifier?Boolean

Returns:

  • (Boolean)


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

def self.cache_identifier?
  @enable_identifier_caching
end

.calculatorObject



58
59
60
# File 'lib/dentaku.rb', line 58

def self.calculator
  @calculator ||= Concurrent::ThreadLocalVar.new { Dentaku::Calculator.new }
end

.enable_ast_cache!Object



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

def self.enable_ast_cache!
  @enable_ast_caching = true
end

.enable_caching!Object



20
21
22
23
24
# File 'lib/dentaku.rb', line 20

def self.enable_caching!
  enable_ast_cache!
  enable_dependency_order_cache!
  enable_identifier_cache!
end

.enable_dependency_order_cache!Object



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

def self.enable_dependency_order_cache!
  @enable_dependency_order_caching = true
end

.enable_identifier_cache!Object



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

def self.enable_identifier_cache!
  @enable_identifier_caching = true
end

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



12
13
14
# File 'lib/dentaku.rb', line 12

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

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



16
17
18
# File 'lib/dentaku.rb', line 16

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