Class: Option

Inherits:
Object
  • Object
show all
Defined in:
lib/ruql/open_assessment/option.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Option

Initializes an option



6
7
8
# File 'lib/ruql/open_assessment/option.rb', line 6

def initialize(options={})
  @points = options[:points] || 0
end

Instance Attribute Details

#opt_explanationObject

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_labelObject

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_nameObject

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

#pointsObject

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

Returns:

  • (Boolean)


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