summaryrefslogtreecommitdiff
path: root/deployment_scripts/puppet/files/embedded/lib/ruby/gems/2.3.0/gems/dentaku-2.0.9/lib/dentaku/ast/functions/rounddown.rb
blob: 4b2625d500960497b06ad73361d6659e96d3761f (plain)
1
2
3
4
5
6
7
require_relative '../function'

Dentaku::AST::Function.register(:rounddown, :numeric, ->(numeric, precision=0) {
  tens = 10.0**precision
  result = (numeric * tens).floor / tens
  precision <= 0 ? result.to_i : result
})