Class: MaRuKu::AttributeList

Inherits:
Array show all
Defined in:
lib/amp-front/third_party/maruku/attributes.rb

Instance Method Summary collapse

Methods inherited from Array

#inspect_more

Instance Method Details

#push_class(val) ⇒ Object

p “Now ”, self ########################################



54
55
56
57
# File 'lib/amp-front/third_party/maruku/attributes.rb', line 54

def push_class(val);        
	raise "Bad :id #{val.inspect}" if not val
	push [:class,  val] 
end

#push_id(val) ⇒ Object



58
59
60
61
# File 'lib/amp-front/third_party/maruku/attributes.rb', line 58

def push_id(val);           
	raise "Bad :id #{val.inspect}" if not val
	push [:id,  val] 
end

#push_key_val(key, val) ⇒ Object



43
44
45
46
# File 'lib/amp-front/third_party/maruku/attributes.rb', line 43

def push_key_val(key, val); 
	raise "Bad #{key.inspect}=#{val.inspect}" if not key and val
	push [key, val] 
end

#push_ref(ref_id) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/amp-front/third_party/maruku/attributes.rb', line 47

def push_ref(ref_id);       
	
	raise "Bad :ref #{ref_id.inspect}" if not ref_id
	push [:ref, ref_id+""] 

#			p "Now ", self ########################################
end

#to_sObject Also known as: to_md



63
64
65
66
67
68
69
70
71
72
# File 'lib/amp-front/third_party/maruku/attributes.rb', line 63

def to_s
	map do |k,v|
		case k
		when :id;    "#" + v.quote_if_needed
		when :class; "." + v.quote_if_needed
		when :ref;    v.quote_if_needed
		else k.quote_if_needed + "=" + v.quote_if_needed
		end
	end . join(' ')
end