Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %w[rubygems RedCloth stringray].each {|dep| require dep }
- class RedCloth::TextileDoc
- def clean(*rules)
- # Fragile! Oh well. )-:
- out = to_html.gsub(/<\/?[^>]*>/, "")
- out.gsub(/\&\#[0123456789]+\;/, "?") # Replace entities with a question mark
- end
- end
- String.send :include, StringRay
- textile = RedCloth.new("A *TESTING* string!")
- characters = words = textile.clean.length
- words = textile.clean.to_stray.select {|w| w.is_a? StringRay::Word }.size
- p [characters, words]
Add Comment
Please, Sign In to add comment