Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created December 17, 2010 11:53
Show Gist options
  • Save ukstudio/744831 to your computer and use it in GitHub Desktop.
Save ukstudio/744831 to your computer and use it in GitHub Desktop.
# coding: utf-8
File.open(ARGV.shift) do |f|
text = f.read
text_to_array = text.split(//)
puts(text_to_array.map do |c|
if c.ascii_only?
0.5
else
1.0
end
end.inject(0,:+))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment