Sha256: 03f66d9bbc98dea2233d08891868a08f7b023fcd5a22ac063f274fafbcb276ad
Contents?: true
Size: 1.93 KB
Versions: 6
Compression:
Stored size: 1.93 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 def can_access_teacher_info_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
6 entries across 6 versions & 2 rubygems