Method: Metrocot::BasePattern#dump_match_map

Defined in:
lib/metrocot.rb

#dump_match_map(out, level, match_map) ⇒ Object



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/metrocot.rb', line 201

def dump_match_map( out, level, match_map )
	if match_map.is_a? Hash
		out << "{\n"
		level += 1
		match_map.each { |key, value|
			out << "  " * level + "#{key} => " 
			dump_match_map( out, level, value )
		}
		level -= 1
		out << "  " * level + "}\n"
	elsif match_map.is_a? Array
		out << "[\n"
		level += 1
		match_map.each { |value|
			out << "  " * level 
			dump_match_map( out, level, value )
		}
		level -= 1
		out << "  " * level + "]\n"
	elsif match_map.is_a? String
		out << "\"" + match_map + "\"\n"
	elsif match_map.is_a? Hpricot::Elem
		out << "<" + match_map.stag.name + ">\n"
	else
		out << match_map.class.to_s + "\n"
	end
end