Sha256: 90d89b8cd556de8c48276d808b789f6277e3613ebef92b3a046dc22a49643408
Contents?: true
Size: 1.87 KB
Versions: 2
Compression:
Stored size: 1.87 KB
Contents
module Mumuki::Domain class IncognitoClass def incognito? true end # ============ # Permissions # ============ def ensure_enabled! end def has_student_granted_organizations? false end def teacher_here? false end def teacher_of?(*) false end def profile_completed? true end def writer? false end def moderator_here? false end def can_discuss_here? false end def can_discuss_in?(*) false end # ======== # Visiting # ======== def visit!(*) end # ======== # Progress # ======== def next_exercise_at(guide) guide.exercises.first end # def completed_containers_with_lookahead(*) # raise 'Unsupported operation. Userless mode and progressive display modes are incompatible' # end def progress_at(content, organization) Indicator.new content: content, organization: organization end def build_assignment(exercise, organization) Assignment.new exercise: exercise, organization: organization, submitter: self end def pending_siblings_at(content) [] end # ============ # ActiveRecord # ============ def id '<incognito>' end def is_a?(other) other.is_a?(Class) && other.name == 'User' || super end def _read_attribute(key) return id if key == 'id' raise "unknown attribute #{key}" end def new_record? false end def self.primary_key 'id' end # ========== # Evaluation # ========== def interpolations [] end def run_submission!(submission, assignment, evaluation) results = submission.dry_run! assignment, evaluation assignment.assign_attributes results results end end Incognito = IncognitoClass.new end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
mumuki-laboratory-7.9.0 | vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-520f859ca8af/lib/mumuki/domain/incognito.rb |
mumuki-domain-7.9.0 | lib/mumuki/domain/incognito.rb |