lib/rails-footnotes/notes/abstract_note.rb in josevalim-rails-footnotes-3.5.0 vs lib/rails-footnotes/notes/abstract_note.rb in josevalim-rails-footnotes-3.6.0
- old
+ new
@@ -153,11 +153,22 @@
<tbody>#{rows.join}</tbody>
</table>
TABLE
end
+ # Mount table for hash, using name and value and adding a name_value class
+ # to the generated table.
+ #
+ def mount_table_for_hash(hash)
+ rows = []
+ hash.each do |key, value|
+ rows << [ key.to_sym.inspect, escape(value.inspect) ]
+ end
+ mount_table(rows.unshift(['Name', 'Value']), :class => 'name_value')
+ end
+
def hash_to_xml_attributes(hash)
return hash.collect{ |key, value| "#{key.to_s}=\"#{value.gsub('"','\"')}\"" }.join(' ')
end
end
end
-end
\ No newline at end of file
+end