Class: MaRuKu::AttributeList
Overview
This represents a list of attributes specified in the Markdown document that apply to a Markdown-generated tag. What was ‘.class key=“val” ref` in the Markdown is parsed into `[[:id, ’id’], [:class, ‘class’], [‘key’, ‘val’], [:ref, ‘ref’]]‘.
Instance Method Summary collapse
- #to_s ⇒ Object (also: #to_md)
Methods inherited from Array
Instance Method Details
#to_s ⇒ Object Also known as: to_md
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/maruku/attributes.rb', line 7 def to_s map do |k, v| value = quote_if_needed(v) case k when :id; "#" + value when :class; "." + value when :ref; value else quote_if_needed(k) + "=" + value end end.join(' ') end |