Sha256: 0a1deab5df566b56b73d2153ef5bab7c0a62914f056a75be44091b11f81c67fa

Contents?: true

Size: 866 Bytes

Versions: 16

Compression:

Stored size: 866 Bytes

Contents

# frozen_string_literal: true

require 'securerandom'

module Meibo
  class Builder
    module ClassroomBuilder
      extend BaseBuilder

      def self.builder_attribute_names
        [:builder, :course, :school, :terms]
      end

      def initialize(builder:, sourced_id: SecureRandom.uuid, course:, school:, terms:, **kw)
        super(
          sourced_id: sourced_id,
          course_sourced_id: course.sourced_id,
          school_sourced_id: school.sourced_id,
          term_sourced_ids: terms.map(&:sourced_id),
          **kw
        )
        @builder = builder
        @course = course
        @school = school
        @terms = terms
        builder.classes << self
      end

      def build_enrollment(**kw)
        builder.build_enrollment(
          classroom: self,
          school: school,
          **kw
        )
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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