class ExoBasic::LikertValue
Constants
- MINIMUM
- UNKNOWN
Attributes
maximum[R]
v[R]
Public Class Methods
likert_avg(total_likert, n, maximum)
click to toggle source
# File lib/exobasic/likert_value.rb, line 37 def self.likert_avg(total_likert, n, maximum) LikertValue.real_to_likert(1.0 * total_likert / (1.0 * n), maximum) end
new(v, maximum)
click to toggle source
# File lib/exobasic/likert_value.rb, line 8 def initialize(v, maximum) @v = [LikertValue::UNKNOWN, [v, maximum].min].max @maximum = maximum end
real_to_likert(v, maximum)
click to toggle source
# File lib/exobasic/likert_value.rb, line 33 def self.real_to_likert(v, maximum) LikertValue.new(v.round(), maximum).normalize_known end
Public Instance Methods
get_extended_range()
click to toggle source
# File lib/exobasic/likert_value.rb, line 17 def get_extended_range LikertValue::UNKNOWN..@maximum end
get_range()
click to toggle source
# File lib/exobasic/likert_value.rb, line 13 def get_range LikertValue::MINIMUM..@maximum end
normalize()
click to toggle source
# File lib/exobasic/likert_value.rb, line 21 def normalize if @v != LikertValue::UNKNOWN [LikertValue::MINIMUM, [@v, @maximum].min].max else LikertValue::UNKNOWN end end
normalize_known()
click to toggle source
# File lib/exobasic/likert_value.rb, line 29 def normalize_known [LikertValue::MINIMUM, [@v, @maximum].min].max end