Class: Grape::ContentTypes::LookupCache
- Inherits:
-
Util::Cache
- Object
- Util::Cache
- Grape::ContentTypes::LookupCache
- Defined in:
- lib/grape/content_types.rb
Instance Attribute Summary
Attributes inherited from Util::Cache
Instance Method Summary collapse
-
#initialize ⇒ LookupCache
constructor
A new instance of LookupCache.
Methods inherited from Util::Cache
Constructor Details
#initialize ⇒ LookupCache
Returns a new instance of LookupCache.
75 76 77 78 79 80 81 82 83 |
# File 'lib/grape/content_types.rb', line 75 def initialize super @cache = Hash.new do |h, from_settings| h[from_settings.dup.freeze] = from_settings.each_with_object({}) do |(format, media_type), lookup| lookup[format] = media_type lookup[format.is_a?(String) ? format.to_sym : format.to_s] = media_type end.freeze end end |