class RenderAsMarkdown::List

Attributes

list_items[RW]

Public Class Methods

new(list_items) click to toggle source
# File lib/render-as-markdown/list.rb, line 6
def initialize list_items
  # list_items will be an array
  @list_items = [*list_items]
end

Public Instance Methods

<<(list_item)
Alias for: add_list_item
add_list_item(list_item) click to toggle source
# File lib/render-as-markdown/list.rb, line 11
def add_list_item list_item
  # concat arrays
  list_items.concat [*list_item]
end
Also aliased as: <<
render() click to toggle source
# File lib/render-as-markdown/list.rb, line 18
def render
  md = ''

  @list_items.each do |item|
    md << "- #{item.to_s}\n"
  end

  md
end
Also aliased as: to_s
to_s()
Alias for: render