diff options
author | Cameron Moore <moorereason@gmail.com> | 2017-09-25 21:01:59 -0500 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-09-26 08:16:24 +0200 |
commit | 8a69d2356703d9f2fcb75bce0ae514e70ebd8e01 (patch) | |
tree | aa2468e16b8e30ead67507a17c1ba20624dcb4ee /tpl/math | |
parent | d9697e275ecb038958b3dcea2b43e11dcba28fc9 (diff) |
tpl: Add math.Ceil, Floor, and Round to method mappings
Diffstat (limited to 'tpl/math')
-rw-r--r-- | tpl/math/init.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tpl/math/init.go b/tpl/math/init.go index 4d740c537..bbffb23aa 100644 --- a/tpl/math/init.go +++ b/tpl/math/init.go @@ -36,6 +36,13 @@ func init() { }, ) + ns.AddMethodMapping(ctx.Ceil, + nil, + [][2]string{ + {"{{math.Ceil 2.1}}", "3"}, + }, + ) + ns.AddMethodMapping(ctx.Div, []string{"div"}, [][2]string{ @@ -43,6 +50,13 @@ func init() { }, ) + ns.AddMethodMapping(ctx.Floor, + nil, + [][2]string{ + {"{{math.Floor 1.9}}", "1"}, + }, + ) + ns.AddMethodMapping(ctx.Log, nil, [][2]string{ @@ -71,6 +85,13 @@ func init() { }, ) + ns.AddMethodMapping(ctx.Round, + nil, + [][2]string{ + {"{{math.Round 1.5}}", "2"}, + }, + ) + ns.AddMethodMapping(ctx.Sub, []string{"sub"}, [][2]string{ |