-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37ef7b3
commit eb200a9
Showing
23 changed files
with
544 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
lib/active_document/errors/invalid_field_type_definition.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module ActiveDocument | ||
module Errors | ||
|
||
# This error is raised when trying to define a field type mapping with | ||
# invalid argument types. | ||
class InvalidFieldTypeDefinition < BaseError | ||
|
||
# Create the new error. | ||
# | ||
# @example Instantiate the error. | ||
# InvalidFieldTypeDefinition.new('number', 123) | ||
# | ||
# @param [ Object ] field_type The object which is expected to a be Symbol or String. | ||
# @param [ Object ] klass The object which is expected to be a Class or Module. | ||
def initialize(field_type, klass) | ||
type_inspection = field_type.try(:inspect) || field_type.class.inspect | ||
klass_inspection = klass.try(:inspect) || klass.class.inspect | ||
super( | ||
compose_message('invalid_field_type_definition', | ||
type_inspection: type_inspection, klass_inspection: klass_inspection) | ||
) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.