Sha256: 8a1b964cebc151eea329e020cd1d50e12d62273cf735cc9ca883b5cba0a40236
Contents?: true
Size: 458 Bytes
Versions: 67
Compression:
Stored size: 458 Bytes
Contents
# encoding: utf-8 class String # convert table format string to array. # # === Example # # sample case. # # BEFORE =<<-EOS # |header1|header2 |header3| # |line1_1| line1_2|line1_3| # EOS # BEFORE.table_to_array # # result # # [["header1", "header2", "header3"], ["line1_1", "line1_2", "line1_3"]] # def table_to_array split("\n").map { |v|v.split('|')[1..-1].map(&:strip) } end end
Version data entries
67 entries across 67 versions & 1 rubygems