Top Level Namespace

Defined Under Namespace

Modules: Bbiff, Bbs Classes: Integer

Instance Method Summary collapse

Instance Method Details

#indent(n, text) ⇒ Object



26
27
28
# File 'lib/bbiff/res_format.rb', line 26

def indent(n, text)
  text.each_line.map { |line| n.en + line }.join
end

#render_body(body) ⇒ Object



30
31
32
33
# File 'lib/bbiff/res_format.rb', line 30

def render_body(body)
  unescaped = CGI.unescapeHTML(body.gsub(/<br>/i, "\n"))
  indent(4, unescaped) + "\n"
end

#render_name(name, email) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/bbiff/res_format.rb', line 14

def render_name(name, email)
  if email.empty?
    name
  else
    name
  end
end

#render_post(post) ⇒ Object



35
36
37
38
# File 'lib/bbiff/res_format.rb', line 35

def render_post(post)
  "#{render_resno post.no}#{render_name post.name, post.mail}#{post.date}\n" \
  "#{render_body post.body}"
end

#render_resno(no) ⇒ Object



22
23
24
# File 'lib/bbiff/res_format.rb', line 22

def render_resno(no)
  no.to_s
end