Guest User

Untitled

a guest
Feb 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. %w[rubygems RedCloth stringray].each {|dep| require dep }
  2.  
  3. class RedCloth::TextileDoc
  4. def clean(*rules)
  5. # Fragile! Oh well. )-:
  6. out = to_html.gsub(/<\/?[^>]*>/, "")
  7. out.gsub(/\&\#[0123456789]+\;/, "?") # Replace entities with a question mark
  8. end
  9. end
  10.  
  11. String.send :include, StringRay
  12.  
  13. textile = RedCloth.new("A *TESTING* string!")
  14. characters = words = textile.clean.length
  15. words = textile.clean.to_stray.select {|w| w.is_a? StringRay::Word }.size
  16.  
  17. p [characters, words]
Add Comment
Please, Sign In to add comment