Sha256: 20e7634bec94a922a733a350a2eed8c90af8ac3e7091247f4d6ff918e753b6d4

Contents?: true

Size: 287 Bytes

Versions: 9

Compression:

Stored size: 287 Bytes

Contents

require_relative '../function'

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dentaku-3.3.4 lib/dentaku/ast/functions/roundup.rb
dentaku-3.3.3 lib/dentaku/ast/functions/roundup.rb
dentaku-3.3.2 lib/dentaku/ast/functions/roundup.rb
dentaku-3.3.1 lib/dentaku/ast/functions/roundup.rb
dentaku-3.3.0 lib/dentaku/ast/functions/roundup.rb
dentaku-3.2.1 lib/dentaku/ast/functions/roundup.rb
dentaku-3.2.0 lib/dentaku/ast/functions/roundup.rb
dentaku-3.1.0 lib/dentaku/ast/functions/roundup.rb
dentaku-3.0.0 lib/dentaku/ast/functions/roundup.rb