Class: Daedal::Attributes::MatchType
- Inherits:
-
Virtus::Attribute
- Object
- Virtus::Attribute
- Daedal::Attributes::MatchType
- Defined in:
- lib/daedal/attributes.rb
Constant Summary collapse
- ALLOWED_MATCH_TYPES =
[:phrase, :phrase_prefix]
Instance Method Summary collapse
Instance Method Details
#coerce(value) ⇒ Object
82 83 84 85 86 87 88 89 90 |
# File 'lib/daedal/attributes.rb', line 82 def coerce(value) unless value.nil? value = value.to_sym unless ALLOWED_MATCH_TYPES.include? value raise "#{value} is not a valid type. Allowed values are #{ALLOWED_MATCH_TYPES}." end end value end |