Sha256: abb9adc736e7fdd6e7dbea1e66663f35d5b10613f871f244d0602ff45219c510
Contents?: true
Size: 877 Bytes
Versions: 38
Compression:
Stored size: 877 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
38 entries across 38 versions & 1 rubygems