Class: ReVIEW::Unfold

Inherits:
Object show all
Defined in:
lib/review/unfold.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(indent_paragraph = false) ⇒ Unfold

Returns a new instance of Unfold.



30
31
32
# File 'lib/review/unfold.rb', line 30

def initialize(indent_paragraph = false)
  @indent_paragraph = indent_paragraph
end

Class Method Details

.unfold(f) ⇒ Object



26
27
28
# File 'lib/review/unfold.rb', line 26

def Unfold.unfold(f)
  new().unfold(f)
end

.unfold_author_source(s) ⇒ Object

unfold paragraphs and strip preprocessor tags.



22
23
24
# File 'lib/review/unfold.rb', line 22

def Unfold.unfold_author_source(s)
  unfold(Preprocessor::Strip.new(StringIO.new(s)))
end

Instance Method Details

#unfold(input, output = nil) ⇒ Object

unfold(f) -> String unfold(input, output) -> nil



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/review/unfold.rb', line 36

def unfold(input, output = nil)
  if output
    @output = output
    do_unfold input
    nil
  else
    @output = StringIO.new
    do_unfold input
    @output.string
  end
end