class Jekyll::Maps::OptionsParser

Constants

ALLOWED_ATTRIBUTES
ALLOWED_FLAGS
OPTIONS_SYNTAX

Public Class Methods

parse(raw_options) click to toggle source
# File lib/jekyll-maps/options_parser.rb, line 24
def parse(raw_options)
  options = {
    :attributes => {},
    :filters    => {},
    :flags      => {}
  }
  raw_options.scan(OPTIONS_SYNTAX).each do |key, value|
    value = value.split(",") if value.include?(",")
    if ALLOWED_ATTRIBUTES.include?(key)
      options[:attributes][key.to_sym] = value
    else
      options[:filters][key] = value
    end
  end
  ALLOWED_FLAGS.each do |key|
    options[:flags][key.to_sym] = true if raw_options.include?(key)
  end
  options
end