blob: bcb7c2dc6be75930c94d257975311e5714b00055 (
plain)
1
2
3
4
5
6
7
8
9
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.
|