Class: AsciiDataTools::RecordTypesConfigurationPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/ascii-data-tools/configuration_printer.rb

Instance Method Summary collapse

Constructor Details

#initialize(record_types) ⇒ RecordTypesConfigurationPresenter

Returns a new instance of RecordTypesConfigurationPresenter.



24
25
26
# File 'lib/ascii-data-tools/configuration_printer.rb', line 24

def initialize(record_types)
  @record_types = record_types
end

Instance Method Details

#headingsObject



28
29
30
# File 'lib/ascii-data-tools/configuration_printer.rb', line 28

def headings
  ["type name", "total length", "constraints", "normalised fields"]
end

#record_type_summariesObject



32
33
34
35
36
# File 'lib/ascii-data-tools/configuration_printer.rb', line 32

def record_type_summaries
  @record_types.sort_by {|record_type| record_type.total_length_of_fields}.inject([]) do |summaries, record_type|
    summaries << [record_type.name, record_type.total_length_of_fields, record_type.constraints_description, record_type.names_of_normalised_fields]
  end
end