Class: MaRuKu::AttributeList
- Inherits:
-
Array
- Object
- Array
- MaRuKu::AttributeList
- Defined in:
- lib/maruku/attributes.rb
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, ‘id’], [‘key’, ‘val’], [:ref, ‘ref’]]‘.
Instance Method Summary collapse
- #to_s ⇒ Object (also: #to_md)
Instance Method Details
#to_s ⇒ Object Also known as: to_md
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/maruku/attributes.rb', line 26 def to_s map do |k, v| case k when :id; "#" + quote_if_needed(v) when :class; "." + quote_if_needed(v) when :ref; quote_if_needed(v) else quote_if_needed(k) + "=" + quote_if_needed(v) end end.join(' ') end |