class Faker::Markdown

def available_methods

def available_methods
  (Markdown.public_methods(false) - Base.methods).sort
end

def block_code

Returns:
  • (String) -
def block_code
  "```ruby\n#{Lorem.sentence(word_count: 1)}\n```"
end

def emphasis

Returns:
  • (String) -
def emphasis
  paragraph = Faker::Lorem.paragraph(sentence_count: 3)
  words = paragraph.split
  position = rand(0..words.length - 1)
  formatting = fetch('markdown.emphasis')
  words[position] = "#{formatting}#{words[position]}#{formatting}"
  words.join(' ')
end

def headers

Returns:
  • (String) -
def headers
  "#{fetch('markdown.headers')} #{Lorem.word.capitalize}"
end

def inline_code

Returns:
  • (String) -
def inline_code
  "`#{Faker::Lorem.sentence(word_count: 1)}`"
end

def ordered_list

Returns:
  • (String) -
def ordered_list
  number = rand(1..10)
  result = []
  number.times do |i|
    result << "#{i}. #{Faker::Lorem.sentence(word_count: 1)} \n"
  end
  result.join
end

def random(*args)

Returns:
  • (String, Array) -

Parameters:
  • methods (Symbol) -- Specify which methods to exclude.

Overloads:
  • random(methods)
def random(*args)
  method_list = available_methods
  args&.each { |ex| method_list.delete_if { |meth| meth == ex.to_sym } }
  send(method_list[Faker::Config.random.rand(0..method_list.length - 1)])
end

def sandwich(sentences: 3, repeat: 1)

Returns:
  • (String) -

Parameters:
  • repeat (Integer) -- Specifies how many times the text block repeats.
  • sentences (Integer) -- Specifies how many sentences make a text block.
def sandwich(sentences: 3, repeat: 1)
  text_block = []
  text_block << headers
  repeat.times do
    text_block << Faker::Lorem.paragraph(sentence_count: sentences)
    text_block << random
  end
  text_block.join("\n")
end

def table

Returns:
  • (String) -
def table
  table = []
  3.times do
    table << "#{Lorem.word} | #{Lorem.word} | #{Lorem.word}"
  end
  table.insert(1, '---- | ---- | ----')
  table.join("\n")
end

def unordered_list

Returns:
  • (String) -
def unordered_list
  number = rand(1..10)
  result = []
  number.times do |_i|
    result << "* #{Faker::Lorem.sentence(word_count: 1)} \n"
  end
  result.join
end