Class: Option
- Inherits:
-
Object
- Object
- Option
- Defined in:
- lib/ruql/open_assessment/option.rb
Instance Attribute Summary collapse
-
#opt_explanation ⇒ Object
Returns the value of attribute opt_explanation.
-
#opt_label ⇒ Object
Returns the value of attribute opt_label.
-
#opt_name ⇒ Object
Returns the value of attribute opt_name.
-
#points ⇒ Object
Returns the value of attribute points.
Instance Method Summary collapse
-
#add_params(score_array) ⇒ Object
Sets preset option paramters.
-
#explanation(explanation) ⇒ Object
Adds explanation to option.
-
#initialize(options = {}) ⇒ Option
constructor
Initializes an option.
-
#label(label) ⇒ Object
Adds label to option.
-
#missing_parameters? ⇒ Boolean
Validation to make sure that all the required fields are in.
-
#name(name) ⇒ Object
Adds name to option.
Constructor Details
#initialize(options = {}) ⇒ Option
Initializes an option
6 7 8 |
# File 'lib/ruql/open_assessment/option.rb', line 6 def initialize(={}) @points = [:points] || 0 end |
Instance Attribute Details
#opt_explanation ⇒ Object
Returns the value of attribute opt_explanation.
2 3 4 |
# File 'lib/ruql/open_assessment/option.rb', line 2 def opt_explanation @opt_explanation end |
#opt_label ⇒ Object
Returns the value of attribute opt_label.
2 3 4 |
# File 'lib/ruql/open_assessment/option.rb', line 2 def opt_label @opt_label end |
#opt_name ⇒ Object
Returns the value of attribute opt_name.
2 3 4 |
# File 'lib/ruql/open_assessment/option.rb', line 2 def opt_name @opt_name end |
#points ⇒ Object
Returns the value of attribute points.
2 3 4 |
# File 'lib/ruql/open_assessment/option.rb', line 2 def points @points end |
Instance Method Details
#add_params(score_array) ⇒ Object
Sets preset option paramters
24 25 26 27 |
# File 'lib/ruql/open_assessment/option.rb', line 24 def add_params(score_array) _, @opt_label, @opt_explanation = score_array @opt_name = @opt_label end |
#explanation(explanation) ⇒ Object
Adds explanation to option
20 |
# File 'lib/ruql/open_assessment/option.rb', line 20 def explanation(explanation) ; @opt_explanation = explanation ; end |
#label(label) ⇒ Object
Adds label to option
16 |
# File 'lib/ruql/open_assessment/option.rb', line 16 def label(label) ; @opt_label = label ; end |
#missing_parameters? ⇒ Boolean
Validation to make sure that all the required fields are in
31 32 33 |
# File 'lib/ruql/open_assessment/option.rb', line 31 def missing_parameters? @opt_name.nil? || @opt_label.nil? || @opt_explanation.nil? end |
#name(name) ⇒ Object
Adds name to option
12 |
# File 'lib/ruql/open_assessment/option.rb', line 12 def name(name) ; @opt_name = name ; end |