Module: AsciiDoc::MacroHelper
- Defined in:
- lib/asciidoc/macrohelper.rb
Class Method Summary collapse
-
.parse_attributes(attributes_string, nokey = "nokey") ⇒ Object
parses a string of attributes into a hash string must look like this: “key=value,key=value”.
Class Method Details
.parse_attributes(attributes_string, nokey = "nokey") ⇒ Object
parses a string of attributes into a hash string must look like this: “key=value,key=value”
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/asciidoc/macrohelper.rb', line 6 def self.parse_attributes(attributes_string, nokey = "nokey") parsed = {} values = attributes_string.split(",") values.each do |value| split = value.split("=") if split.size == 1 split << split[0] split[0] = nokey end parsed[split[0]] = split[1] end parsed end |