Class: Bcat::TextFilter
- Inherits:
-
Object
- Object
- Bcat::TextFilter
- Includes:
- Rack::Utils
- Defined in:
- lib/bcat/reader.rb
Instance Method Summary collapse
- #each {|"<pre>"| ... } ⇒ Object
-
#initialize(source, force = false) ⇒ TextFilter
constructor
A new instance of TextFilter.
Constructor Details
#initialize(source, force = false) ⇒ TextFilter
Returns a new instance of TextFilter.
87 88 89 90 |
# File 'lib/bcat/reader.rb', line 87 def initialize(source, force=false) @source = source @force = force end |
Instance Method Details
#each {|"<pre>"| ... } ⇒ Object
92 93 94 95 96 97 98 99 100 |
# File 'lib/bcat/reader.rb', line 92 def each yield "<pre>" @source.each do |chunk| chunk = escape_html(chunk) chunk = "<span>#{chunk}</span>" if !chunk.gsub!(/\n/, "<br>") yield chunk end yield "</pre>" end |