Class: Jekyll::ScalaFiddle::OptionsParser
- Inherits:
-
Object
- Object
- Jekyll::ScalaFiddle::OptionsParser
- Defined in:
- lib/jekyll-scalafiddle.rb
Constant Summary collapse
- OPTIONS_SYNTAX =
%r!([^\s]+)\s*=\s*['"]+([^'"]+)['"]+!
- ALLOWED_FLAGS =
%w( autorun ).freeze
- ALLOWED_ATTRIBUTES =
%w( template prefix dependency scalaversion selector minheight layout theme ).freeze
Class Method Summary collapse
Class Method Details
.parse(raw_options) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/jekyll-scalafiddle.rb', line 20 def parse() = { :attributes => {}, :filters => {}, :flags => {} } .scan(OPTIONS_SYNTAX).each do |key, value| if ALLOWED_ATTRIBUTES.include?(key) [:attributes][key.to_sym] = value else [:filters][key] = value end end ALLOWED_FLAGS.each do |key| [:flags][key.to_sym] = true if .include?(key) end end |