Sha256: eb83c9b3ee9a7ba38358ba8af9dcd563235e2ced19499138cd415dce7e7f0f97

Contents?: true

Size: 472 Bytes

Versions: 7

Compression:

Stored size: 472 Bytes

Contents

# encoding: utf-8
require 'fedux_org_stdlib/require_files'
require_library %w( hirb )

module FeduxOrgStdlib
  class List

    private

    attr_reader :data

    public

    def initialize(*data)
      @data = data.flatten.map { |e| Hash(e) }
    end

    # Render data to table
    def to_s(**options)
      Hirb::Helpers::Table.render data, header_filter: proc { |h| h.humanize }, **options
    end

    # Data as array
    def to_a
      Array(data)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.7.21 lib/fedux_org_stdlib/list.rb
fedux_org-stdlib-0.7.20 lib/fedux_org_stdlib/list.rb
fedux_org-stdlib-0.7.19 lib/fedux_org_stdlib/list.rb
fedux_org-stdlib-0.7.18 lib/fedux_org_stdlib/list.rb
fedux_org-stdlib-0.7.17 lib/fedux_org_stdlib/list.rb
fedux_org-stdlib-0.7.16 lib/fedux_org_stdlib/list.rb
fedux_org-stdlib-0.7.15 lib/fedux_org_stdlib/list.rb