Class: Dentaku::AST::Duration

Inherits:
Function show all
Defined in:
lib/dentaku/ast/functions/duration.rb

Defined Under Namespace

Classes: Value

Constant Summary

Constants inherited from Function

Function::DIG

Instance Attribute Summary

Attributes inherited from Function

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Function

#accept, get, #initialize, numeric, register, register_class, registry

Methods inherited from Node

arity, #name, precedence, resolve_class

Constructor Details

This class inherits a constructor from Dentaku::AST::Function

Class Method Details

.max_param_countObject



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

def self.max_param_count
  2
end

.min_param_countObject



6
7
8
# File 'lib/dentaku/ast/functions/duration.rb', line 6

def self.min_param_count
  2
end

Instance Method Details

#dependencies(context = {}) ⇒ Object



43
44
45
46
# File 'lib/dentaku/ast/functions/duration.rb', line 43

def dependencies(context = {})
  value_node = @args.first
  value_node.dependencies(context)
end

#typeObject



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

def type
  :duration
end

#value(context = {}) ⇒ Object



38
39
40
41
# File 'lib/dentaku/ast/functions/duration.rb', line 38

def value(context = {})
  value_node, unit_node = *@args
  Value.new(value_node.value(context), unit_node.identifier)
end