Module: Acme::Bleach
- Defined in:
- lib/acme/bleach.rb,
lib/acme/bleach/version.rb
Constant Summary collapse
- Header =
( " \t" * 8 ) + "\n"
- WhiteChars =
" \t"
- VERSION =
"0.0.4"
Class Method Summary collapse
Class Method Details
.bleached?(c) ⇒ Boolean
9 10 11 |
# File 'lib/acme/bleach.rb', line 9 def bleached? c !! c.match(/\A#{Header}/) end |
.brighten(c) ⇒ Object
17 18 19 |
# File 'lib/acme/bleach.rb', line 17 def brighten c c.sub!(/\A#{Header}/, '') ? [ c.tr(WhiteChars, "01") ].pack('b*') : c end |
.whiten(c) ⇒ Object
13 14 15 |
# File 'lib/acme/bleach.rb', line 13 def whiten c Header + c.unpack( 'b*').join('').tr("01", WhiteChars) end |