Sha256: 6e98a1165821cccbf8c1f0dec606925a4c94f9408fd34a378eaec7968dfd8b2f

Contents?: true

Size: 219 Bytes

Versions: 6

Compression:

Stored size: 219 Bytes

Contents

require_relative '../function'

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dentaku-2.0.11 lib/dentaku/ast/functions/roundup.rb
dentaku-2.0.10 lib/dentaku/ast/functions/roundup.rb
dentaku-2.0.9 lib/dentaku/ast/functions/roundup.rb
dentaku-2.0.8 lib/dentaku/ast/functions/roundup.rb
dentaku-2.0.7 lib/dentaku/ast/functions/roundup.rb
dentaku-2.0.6 lib/dentaku/ast/functions/roundup.rb