Module: Jsapi::InvalidValueHelper
- Included in:
- InvalidArgumentError, InvalidValueError
- Defined in:
- lib/jsapi/invalid_value_helper.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#build_message(name, value, valid_values) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/jsapi/invalid_value_helper.rb', line 5 def (name, value, valid_values) case valid_values.count when 0 "#{name} must not be #{value.inspect}" when 1 "#{name} must be #{valid_values.first.inspect}, is #{value.inspect}" else "#{name} must be one of #{valid_values[0..-2].map(&:inspect).join(', ')} " \ "or #{valid_values.last.inspect}, is #{value.inspect}" end end |