Class: Daedal::Attributes::Flag

Inherits:
Virtus::Attribute
  • Object
show all
Defined in:
lib/daedal/attributes/flag.rb

Constant Summary collapse

ALLOWED_FLAGS =
[
  :all,
  :none,
  :and,
  :or,
  :not,
  :prefix,
  :phrase,
  :precedence,
  :escape,
  :whitespace,
  :fuzzy,
  :near,
  :slop
]

Instance Method Summary collapse

Instance Method Details

#coerce(value) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/daedal/attributes/flag.rb', line 21

def coerce(value)
  unless value.nil?
    value = value.to_sym
    unless ALLOWED_FLAGS.include? value
      raise Virtus::CoercionError.new(value, 'Daedal::Attributes::Flag')
    end
  end
  value
end