Class: Daedal::Attributes::LowerCaseString

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

Instance Method Summary collapse

Instance Method Details

#coerce(value) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/daedal/attributes/lower_case_string.rb', line 5

def coerce(value)
  value = value.to_s
  if value.empty?
    raise Virtus::CoercionError.new(value, 'Daedal::Attributes::LowerCaseString')
  end
  value.downcase
end