Sha256: c91d4fc088614d7bb4936593c5fa11af1f842ecd415f2ac4341421a488e2cb27

Contents?: true

Size: 403 Bytes

Versions: 2

Compression:

Stored size: 403 Bytes

Contents

#! /usr/bin/env ruby
#
require 'bundler/setup'
require 'console'

class Demo
  include Console

  define_cmd(:hello, "print hello") do
    puts "hello #{`whoami`}"
  end

  define_cmd(:rand, "output rand number") do |max = 100|
    puts rand(max.to_i)
  end

  define_cmd(:incr, "increment number") do |i = 1|
    @incr_number ||= 0
    puts @incr_number += i.to_i
  end
end

Demo.new.start("demo > ")

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_console-0.0.3 examples/demo.rb
simple_console-0.0.2 examples/demo.rb