Module: Meibo::Converter

Defined in:
lib/meibo/converter.rb

Constant Summary collapse

TYPES =
%i[
  list
  required
  boolean
  date
  datetime
  enum
  format
  fullwidth
  mext_grade_code
  integer
  status
  user_ids
  year
].freeze

Class Method Summary collapse

Class Method Details

.build_header_field_to_attribute_converter(attribute_name_to_header_field_map) ⇒ Object



26
27
28
29
30
31
# File 'lib/meibo/converter.rb', line 26

def build_header_field_to_attribute_converter(attribute_name_to_header_field_map)
  header_field_to_attribute_name_map = attribute_name_to_header_field_map.to_h do |attribute, header_field|
    [header_field, attribute]
  end.freeze
  ->(field) { header_field_to_attribute_name_map.fetch(field, field) }
end

.build_parser_converter(fields:, converters:) ⇒ Object



33
34
35
# File 'lib/meibo/converter.rb', line 33

def build_parser_converter(fields:, converters:)
  build_converter(fields: fields, converters: converters, write_or_parser: "parser")
end

.build_write_converter(fields:, converters:) ⇒ Object



37
38
39
# File 'lib/meibo/converter.rb', line 37

def build_write_converter(fields:, converters:)
  build_converter(fields: fields, converters: converters, write_or_parser: "write")
end