Sha256: 34e3f1b5f3ca0f981f6431290110c9121bf180a821fde0fdd8da148ed765977f
Contents?: true
Size: 876 Bytes
Versions: 6
Compression:
Stored size: 876 Bytes
Contents
# encoding: utf-8 require 'fedux_org_stdlib/require_files' require_library %w( hirb ) #require_library %w( tty ) module FeduxOrgStdlib # A list # # @example Usage # # data = [ # { # item1: 'data1', # item2: 'data2' # }, # { # item1: 'data1', # item2: 'data2' # }, # ] # # list = List.new(data) # puts list class List private attr_reader :data public def initialize(*data) @data = data.flatten.map { |e| Hash(e) } end # Render data to table # # @param [Hash] options # Options which are supported by Hirb def to_s(**options) Hirb::Helpers::Table.render data, header_filter: proc(&:humanize), **options end # Data as array # # @return [Array] # The data as array def to_a Array(data) end end end
Version data entries
6 entries across 6 versions & 1 rubygems