Sha256: 418530d8cf356cb521a1c045b2b98d0f22b48602038cf11db6b131d1baf720d8
Contents?: true
Size: 796 Bytes
Versions: 56
Compression:
Stored size: 796 Bytes
Contents
# encoding: utf-8 # Hash class Hash # get html table string from key + value # # ==== Examples # # valid commma case # # { # :key_1 => :value1, # :key__2 => :value2, # :key___3 => :value3, # }.html_table # # result # # <table> # <tr> # <td>key_1</td> # <td>value1</td> # </tr> # <tr> # <td>key__2</td> # <td>value2</td> # </tr> # <tr> # <td>key___3</td> # <td>value3</td> # </tr> # </table> # def html_table ret = [keys, values].treduce(['<table>']) do |ret, one, other| ret << " <tr>\n <td>#{one}</td>\n <td>#{other}</td>\n </tr>" ret end ret.join("\n") + "\n</table>\n" end end
Version data entries
56 entries across 56 versions & 1 rubygems