# File lib/versionomy/schema/field.rb, line 211 def canonicalize_value(value_) orig_value_ = value_ if @canonicalize_proc value_ = @canonicalize_proc.call(value_) else case @type when :integer value_ = value_.to_i rescue nil when :string value_ = value_.to_s rescue nil when :symbol value_ = value_.to_sym rescue nil end end if value_.nil? || (@type == :symbol && !@symbol_info.has_key?(value_)) raise Errors::IllegalValueError, "#{@name} does not allow the value #{orig_value_.inspect}" end value_ end