From 70690604e7ea6fd6b89c256a52d65a308ad0fe77 Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 17 Oct 2006 09:44:47 +0000 Subject: Moved demos to sample/. --- sample/demo_count.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sample/demo_count.rb (limited to 'sample/demo_count.rb') diff --git a/sample/demo_count.rb b/sample/demo_count.rb new file mode 100644 index 0000000..bcb7c2d --- /dev/null +++ b/sample/demo_count.rb @@ -0,0 +1,10 @@ +require 'coderay' + +stats = CodeRay.encoder(:statistic) +stats.encode("puts 17 + 4\n", :ruby) + +puts '%d out of %d tokens have the kind :integer.' % [ + stats.type_stats[:integer].count, + stats.real_token_count +] +#-> 2 out of 4 tokens have the kind :integer. -- cgit v1.2.1