Class: Dentaku::AST::Function
Constant Summary collapse
- DIG =
Returns with the number of significant decimal digits to use.
Float::DIG + 1
Constants inherited from Node
Node::STATIC_CONTEXT, Node::STATIC_MODE_KEY
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Class Method Summary collapse
- .get(name) ⇒ Object
- .register(name, type, implementation, volatile: false) ⇒ Object
- .register_class(name, function_class) ⇒ Object
- .registry ⇒ Object
-
.volatile? ⇒ Boolean
volatile functions may not be evaluated during dependency resolution; registry-generated classes override this per the volatile: option passed at registration.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #dependencies(context = {}) ⇒ Object
-
#initialize(*args) ⇒ Function
constructor
A new instance of Function.
Methods inherited from Node
arity, #name, precedence, #pure?, resolve_class, #type
Constructor Details
#initialize(*args) ⇒ Function
Returns a new instance of Function.
12 13 14 |
# File 'lib/dentaku/ast/function.rb', line 12 def initialize(*args) @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
7 8 9 |
# File 'lib/dentaku/ast/function.rb', line 7 def args @args end |
Class Method Details
.get(name) ⇒ Object
32 33 34 |
# File 'lib/dentaku/ast/function.rb', line 32 def self.get(name) registry.get(name) end |
.register(name, type, implementation, volatile: false) ⇒ Object
36 37 38 |
# File 'lib/dentaku/ast/function.rb', line 36 def self.register(name, type, implementation, volatile: false) registry.register(name, type, implementation, volatile: volatile) end |
.register_class(name, function_class) ⇒ Object
40 41 42 |
# File 'lib/dentaku/ast/function.rb', line 40 def self.register_class(name, function_class) registry.register_class(name, function_class) end |
.registry ⇒ Object
44 45 46 |
# File 'lib/dentaku/ast/function.rb', line 44 def self.registry @registry ||= FunctionRegistry.new end |
.volatile? ⇒ Boolean
volatile functions may not be evaluated during dependency resolution; registry-generated classes override this per the volatile: option passed at registration
28 29 30 |
# File 'lib/dentaku/ast/function.rb', line 28 def self.volatile? false end |
Instance Method Details
#accept(visitor) ⇒ Object
16 17 18 |
# File 'lib/dentaku/ast/function.rb', line 16 def accept(visitor) visitor.visit_function(self) end |
#dependencies(context = {}) ⇒ Object
20 21 22 23 |
# File 'lib/dentaku/ast/function.rb', line 20 def dependencies(context = {}) @args.each_with_index .flat_map { |a, _| a.dependencies(context) } end |