Class: CodelessCode::Formats::CleanupBody
- Inherits:
-
Object
- Object
- CodelessCode::Formats::CleanupBody
- Defined in:
- lib/codeless_code/formats/plain.rb
Overview
Tidies up the mixed syntax found in fables
Instance Method Summary collapse
-
#initialize(body) ⇒ CleanupBody
constructor
A new instance of CleanupBody.
- #to_s ⇒ Object
Constructor Details
#initialize(body) ⇒ CleanupBody
39 40 41 |
# File 'lib/codeless_code/formats/plain.rb', line 39 def initialize(body) @body = body end |
Instance Method Details
#to_s ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/codeless_code/formats/plain.rb', line 43 def to_s [ [%r{//\w*$}, ''], [%r{<i>([^<]+)</i>}mi, '\1'], [%r{<b>([^<]+)</b>}mi, '\1'], [%r{<a[^>]+>([^<]+)</a>}mi, '\1'], [%r{/(\w+)/}, '\1'] ].inject(@body) { |str, args| str.gsub(*args) } end |