Class: Quby::Questionnaires::Entities::ScoreCalculation
- Inherits:
-
Object
- Object
- Quby::Questionnaires::Entities::ScoreCalculation
- Defined in:
- lib/quby/questionnaires/entities/score_calculation.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#label ⇒ Object
Returns the value of attribute label.
-
#options ⇒ Object
Returns the value of attribute options.
-
#sbg_key ⇒ Object
Returns the value of attribute sbg_key.
Instance Method Summary collapse
- #action ⇒ Object
- #calculation ⇒ Object
- #completion ⇒ Object
-
#initialize(key, options, &block) ⇒ ScoreCalculation
constructor
A new instance of ScoreCalculation.
- #score ⇒ Object
Constructor Details
#initialize(key, options, &block) ⇒ ScoreCalculation
Returns a new instance of ScoreCalculation.
37 38 39 40 41 42 43 44 |
# File 'lib/quby/questionnaires/entities/score_calculation.rb', line 37 def initialize(key, , &block) @key = key @label = [:label] @sbg_key = [:sbg_key] @options = [:options] || # TODO remove `|| options` @sourcecode = [:sourcecode] @block = block end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
35 36 37 |
# File 'lib/quby/questionnaires/entities/score_calculation.rb', line 35 def key @key end |
#label ⇒ Object
Returns the value of attribute label.
35 36 37 |
# File 'lib/quby/questionnaires/entities/score_calculation.rb', line 35 def label @label end |
#options ⇒ Object
Returns the value of attribute options.
35 36 37 |
# File 'lib/quby/questionnaires/entities/score_calculation.rb', line 35 def @options end |
#sbg_key ⇒ Object
Returns the value of attribute sbg_key.
35 36 37 |
# File 'lib/quby/questionnaires/entities/score_calculation.rb', line 35 def sbg_key @sbg_key end |
Instance Method Details
#action ⇒ Object
62 63 64 |
# File 'lib/quby/questionnaires/entities/score_calculation.rb', line 62 def action @options[:action] end |
#calculation ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/quby/questionnaires/entities/score_calculation.rb', line 46 def calculation if @block @block else StripOuterScoreCall.instance_eval(@sourcecode) end end |
#completion ⇒ Object
58 59 60 |
# File 'lib/quby/questionnaires/entities/score_calculation.rb', line 58 def completion @options[:completion] end |
#score ⇒ Object
54 55 56 |
# File 'lib/quby/questionnaires/entities/score_calculation.rb', line 54 def score @options[:score] end |