Class: GraphqlDevise::MountMethod::OptionSanitizers::StringChecker
- Inherits:
-
Object
- Object
- GraphqlDevise::MountMethod::OptionSanitizers::StringChecker
- Defined in:
- lib/graphql_devise/mount_method/option_sanitizers/string_checker.rb
Instance Method Summary collapse
- #call!(value, key) ⇒ Object
-
#initialize(default_string = nil) ⇒ StringChecker
constructor
A new instance of StringChecker.
Constructor Details
#initialize(default_string = nil) ⇒ StringChecker
Returns a new instance of StringChecker.
7 8 9 |
# File 'lib/graphql_devise/mount_method/option_sanitizers/string_checker.rb', line 7 def initialize(default_string = nil) @default_string = default_string end |
Instance Method Details
#call!(value, key) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/graphql_devise/mount_method/option_sanitizers/string_checker.rb', line 11 def call!(value, key) return @default_string if value.blank? unless value.instance_of?(String) raise InvalidMountOptionsError, "`#{key}` option has an invalid value. String expected." end value end |