Class: Daedal::Attributes::ScoreMode
- Inherits:
-
Virtus::Attribute
- Object
- Virtus::Attribute
- Daedal::Attributes::ScoreMode
- Defined in:
- lib/daedal/attributes/score_mode.rb
Constant Summary collapse
- ALLOWED_SCORE_MODES =
[:avg, :total, :max, :none]
Instance Method Summary collapse
Instance Method Details
#coerce(value) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/daedal/attributes/score_mode.rb', line 6 def coerce(value) unless value.nil? value = value.to_sym unless ALLOWED_SCORE_MODES.include? value raise Virtus::CoercionError.new(value, 'Daedal::Attributes::MatchType') end end value end |