Class: MaRuKu::AttributeList

Inherits:
Array
  • Object
show all
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, 'class'], ['key', 'val'], [:ref, 'ref']]`.

Instance Method Summary collapse

Methods inherited from Array

#replace_each_string

Instance Method Details

#to_sObject 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