class ApiTommy::Markdown
Public Class Methods
code(text, language = nil)
click to toggle source
# File lib/api_tommy/markdown.rb, line 15 def self.code(text, language = nil) result = "\n```" result << language unless language.nil? result << "\n#{text}\n```\n" end
p(text)
click to toggle source
# File lib/api_tommy/markdown.rb, line 11 def self.p(text) "\n#{text.gsub(/[\n]+/, " ")}\n" end
th(*headers)
click to toggle source
# File lib/api_tommy/markdown.rb, line 25 def self.th(*headers) "\n".tap do |result| headers.each { |header| result << "| #{header} " } result << "\n" headers.size.times.each { result << "| --- " } result << "\n" end end
title(text, level)
click to toggle source
# File lib/api_tommy/markdown.rb, line 7 def self.title(text, level) "\n#{"#" * level} #{text}\n" end
tr(*values)
click to toggle source
# File lib/api_tommy/markdown.rb, line 34 def self.tr(*values) "".tap do |result| values.each { |value| result << "| #{value} " } result << "\n" end end
ul(text)
click to toggle source
# File lib/api_tommy/markdown.rb, line 21 def self.ul(text) "* #{text}\n" end