Exception: Basecamp::AmbiguousError
- Defined in:
- lib/basecamp/ambiguous_error.rb
Overview
Raised when a name/identifier matches multiple resources.
Instance Attribute Summary collapse
-
#matches ⇒ Array<String>
readonly
List of matching resources.
Instance Method Summary collapse
-
#initialize(resource, matches: []) ⇒ AmbiguousError
constructor
A new instance of AmbiguousError.
Constructor Details
#initialize(resource, matches: []) ⇒ AmbiguousError
Returns a new instance of AmbiguousError.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/basecamp/ambiguous_error.rb', line 9 def initialize(resource, matches: []) @matches = matches hint = if matches.any? && matches.length <= 5 "Did you mean: #{matches.join(", ")}" else "Be more specific" end super( code: ErrorCode::AMBIGUOUS, message: "Ambiguous #{resource}", hint: hint ) end |
Instance Attribute Details
#matches ⇒ Array<String> (readonly)
Returns list of matching resources.
7 8 9 |
# File 'lib/basecamp/ambiguous_error.rb', line 7 def matches @matches end |