class Mummy::Parsers::MarkdownParser
Public Class Methods
provide_options(slop_options)
click to toggle source
# File lib/mummy/parsers/markdown_parser.rb, line 10 def self.provide_options(slop_options) slop_options.integer "--markdown-heading-level", "Heading level to use to find items (e.g. 2 means '##')", default: 2 end
Public Instance Methods
items()
click to toggle source
# File lib/mummy/parsers/markdown_parser.rb, line 4 def items @items ||= input.lines.select do |line| line.start_with?("#{heading_marker} ") end.map { |line| line[2..-1].strip } end
Private Instance Methods
heading_marker()
click to toggle source
This weird symbol/string combo below is annoying. I’ve made a PR to ‘slop` to fix it, see github.com/leejarvis/slop/pull/169
# File lib/mummy/parsers/markdown_parser.rb, line 20 def heading_marker "#" * options[:"markdown-heading-level"] end