Sha256: 189177cb1ca48a53cb82212a8714cee195ae88ed16d89bd665e2b5c8fac1e017
Contents?: true
Size: 841 Bytes
Versions: 2
Compression:
Stored size: 841 Bytes
Contents
require "bundler/gem_tasks" require "rake/testtask" Rake::TestTask.new(:test) do |t| t.libs << "test" t.libs << "lib" t.test_files = FileList["test/**/*_test.rb"] end task default: :test namespace :sample do require 'ascii_chart' desc 'Out put a random case' task :random do sample = Random.rand(3) Rake::Task["sample:#{sample + 1}"].invoke end desc 'Output the first case' task :'1' do puts AsciiChart.plot((0...90).map { |i| Math.cos(i * ((Math::PI * 4) / 90)).round(2) * 5 }) end desc 'Output the second case' task :'2' do puts AsciiChart.plot((0...90).map { |i| Math.cos(i * ((Math::PI * 8) / 90)).round(2) * 10 }) end desc 'Output the third case' task :'3' do puts AsciiChart.plot(90.times.map { Random.rand(10) * (-1) ** Random.rand(2) }) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ascii_chart-0.2.0 | Rakefile |
ascii_chart-0.1.0 | Rakefile |