ruby_proctor 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8e821a3925f6fa1e17760fa60e7d061f48f2f4d34ebe8d6a823894b4b780b4cc
4
+ data.tar.gz: 86dcbbceb14317d4fbd877b430250bda3ee39b65a34b95e61799eb71e090c92b
5
+ SHA512:
6
+ metadata.gz: 16c2d659e40f02e79fa2249e24f5e8e68cf87787ffbe58de2e0edc4dac9ed1c48632d8cb64b15f2d31b05fe8c128b2927b917ae48b0b276291170272772a9e53
7
+ data.tar.gz: aad6a196e39566a9adf5311831abb0c839981137794cee053b8b5325b221f86dafc55b85fc2bdf008d6fb935efa65fa0e4d7c95d48cd193f5e9afb3658e55377
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Jason Schafer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # ruby-proctor
2
+ Exam Proctor Built w/ Ruby
data/bin/ruby_proctor ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Include Dir for OCRA
4
+ $LOAD_PATH.unshift File.join(File.dirname($0), '../lib')
5
+
6
+ require 'rubygems'
7
+ require 'bundler/setup'
8
+
9
+ require 'ruby_proctor.rb'
10
+
11
+ ruby_proctor()
@@ -0,0 +1,3 @@
1
+ @rubyProctor.exe computer_trivia.q 10 10
2
+ @echo Press any key to close . . .
3
+ @pause > nul
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ ./ruby_proctor computer_trivia.q 10 10
@@ -0,0 +1,10 @@
1
+ class Configuration
2
+
3
+ attr_accessor :filepath, :num_questions, :time_limit
4
+
5
+ def initialize
6
+ @filepath = ''
7
+ @num_questions = 10
8
+ @time_limit = 10
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ require 'os'
2
+
3
+ module Constants
4
+ COMMENT = '*'
5
+ Q_START = '@Q'
6
+ A_START = '@A'
7
+ A_END = '@E'
8
+
9
+ QUESTION_NUM_LINES = 10
10
+ QUIZ_MAX_QUESTIONS = 10000
11
+
12
+ QUIZ_FILE_NAME = OS.windows? ? "quizlog.dat" : ".quizlog"
13
+ end
@@ -0,0 +1,20 @@
1
+ require 'ruby_proctor/hashify'
2
+
3
+ class Exam
4
+
5
+ attr_accessor :questions, :results
6
+
7
+ def initialize(quiz_name, questions)
8
+ @questions = questions
9
+ @results = Results.new(quiz_name)
10
+ end
11
+
12
+ class Results
13
+ include Hashify
14
+ attr_accessor :uid, :quiz_name, :time_started, :time_completed, :time_elapsed, :time_left, :grade, :letter_grade, :num_correct, :total_questions
15
+
16
+ def initialize(quiz_name)
17
+ @quiz_name = quiz_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ module Hashify
2
+ # Classes that include this module can exclude certain
3
+ # instance variable from its hash representation by overriding
4
+ # this method
5
+ def ivars_excluded_from_hash
6
+ []
7
+ end
8
+
9
+ def to_hash
10
+ hash = {}
11
+ excluded_ivars = ivars_excluded_from_hash
12
+
13
+ # Iterate over all the instance variables and store their
14
+ # names and values in a hash
15
+ instance_variables.each do |var|
16
+ next if excluded_ivars.include? var.to_s
17
+
18
+ value = instance_variable_get(var)
19
+ value = value.map(&:to_hash) if value.is_a? Array
20
+
21
+ hash[var.to_s.delete("@")] = value
22
+ end
23
+
24
+ return hash
25
+ end
26
+ end