Sha256: 81c7135f859eb0b9cf3fe089e1837ac3ac12b04339f472e0d173ee1b0197e963

Contents?: true

Size: 1.55 KB

Versions: 4

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

module Meibo
  class RoleSet < DataSet
    def check_semantically_consistent
      super

      each do |role|
        roster.organizations.find(role.org_sourced_id)
        roster.users.find(role.user_sourced_id)

        if role.user_profile_sourced_id
          roster.user_profiles.find(role.user_profile_sourced_id)
        end
      end
    end

    def primary
      @cache[:primary] ||= new(select(&:primary?))
    end

    def secondary
      @cache[:secondary] ||= new(select(&:secondary?))
    end

    def aide
      @cache[:aide] ||= new(select(&:aide?))
    end

    def counselor
      @cache[:counselor] ||= new(select(&:counselor?))
    end

    def district_administrator
      @cache[:district_administrator] ||= new(select(&:district_administrator?))
    end

    def guardian
      @cache[:guardian] ||= new(select(&:guardian?))
    end

    def parent
      @cache[:parent] ||= new(select(&:parent?))
    end

    def principal
      @cache[:principal] ||= new(select(&:principal?))
    end

    def proctor
      @cache[:proctor] ||= new(select(&:proctor?))
    end

    def relative
      @cache[:relative] ||= new(select(&:relative?))
    end

    def site_administrator
      @cache[:site_administrator] ||= new(select(&:site_administrator?))
    end

    def student
      @cache[:student] ||= new(select(&:student?))
    end

    def system_administrator
      @cache[:system_administrator] ||= new(select(&:system_administrator?))
    end

    def teacher
      @cache[:teacher] ||= new(select(&:teacher?))
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
meibo-0.16.0 lib/meibo/role_set.rb
meibo-0.15.0 lib/meibo/role_set.rb
meibo-0.14.0 lib/meibo/role_set.rb
meibo-0.13.0 lib/meibo/role_set.rb