Sha256: 53dcae79b0d5f624a40c524c68f0694dbf7dd854caaa025a8d3bbc8aac0f8fcc

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Meibo
  class JapanProfile < ::Meibo::Profile
    class AcademicSession < ::Meibo::AcademicSession
      TYPES = { school_year: 'schoolYear' }.freeze

      DataModel.define(
        self,
        attribute_name_to_header_field_map: superclass.attribute_name_to_header_field_map,
        converters: superclass.converters.merge(
          enum: { type: TYPES.values.freeze }.freeze
        )
      )

      # NOTE: 以下固定
      #   - titleは連携処理実行時の対象年度西暦 + 「年度」を設定
      #   - typeはschoolYear固定
      #   - start_dateは対象年度の開始日固定
      #   - end_dateは対象年度の終了日固定
      def initialize(school_year:, title: "#{school_year}年度", type: TYPES[:school_year], start_date: Date.new(school_year, 4, 1), end_date: Date.new(school_year + 1, 3, 31), **other_fields)
        super(school_year: school_year, title: title, type: type, start_date: start_date, end_date: end_date, **other_fields)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
meibo-0.16.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.15.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.14.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.13.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.12.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.11.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.10.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.9.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.8.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.7.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.6.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.5.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.4.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.3.0 lib/meibo/japan_profile/academic_session.rb
meibo-0.2.0 lib/meibo/japan_profile/academic_session.rb