Sha256: 85f9fcf1f7be0d08fff91c0a709e47528bc8959fe094094bd5c1b743d144f476
Contents?: true
Size: 384 Bytes
Versions: 3
Compression:
Stored size: 384 Bytes
Contents
# frozen_string_literal: true module Basic101 class RndFunction < Function def initialize @rand = 0 end def name 'RND' end def call(runtime, args) check_args args, [BasicNumeric] new_number = args.first.eval(runtime).to_f > 0 if new_number @rand = runtime.rand end BasicFloat.new(@rand) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
basic101-1.0.2 | lib/basic101/rnd_function.rb |
basic101-1.0.1 | lib/basic101/rnd_function.rb |
basic101-1.0.0 | lib/basic101/rnd_function.rb |