Module: Grape::Middleware::DeprecatedOptionsHashAccess
- Included in:
- Error::Options, Formatter::Options, Versioner::Base::Options
- Defined in:
- lib/grape/middleware/deprecated_options_hash_access.rb
Overview
Mixin for per-middleware Options Data classes that need to keep accepting legacy data[:key] Hash-style access while nudging callers toward the named accessor. Emits a Grape.deprecator warning then forwards to public_send(key).
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/grape/middleware/deprecated_options_hash_access.rb', line 10 def [](key) Grape.deprecator.warn( "`#{self.class.name}#[]` is deprecated. " \ "Use the named accessor `#{key}` instead." ) public_send(key) if members.include?(key) end |