Class: FeduxOrgStdlib::List

Inherits:
Object
  • Object
show all
Defined in:
lib/fedux_org_stdlib/list.rb

Instance Method Summary collapse

Constructor Details

#initialize(*data) ⇒ List

Returns a new instance of List.



13
14
15
# File 'lib/fedux_org_stdlib/list.rb', line 13

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

Instance Method Details

#to_aObject

Data as array



23
24
25
# File 'lib/fedux_org_stdlib/list.rb', line 23

def to_a
  Array(data)
end

#to_s(**options) ⇒ Object

Render data to table



18
19
20
# File 'lib/fedux_org_stdlib/list.rb', line 18

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