Class: Jsapi::Meta::Response::Wrapper

Inherits:
Model::Wrapper
  • Object
show all
Defined in:
lib/jsapi/meta/response/wrapper.rb

Instance Attribute Summary collapse

Attributes inherited from Model::Wrapper

#definitions

Instance Method Summary collapse

Methods inherited from Model::Wrapper

#==, #inspect

Constructor Details

#initialize(response, definitions) ⇒ Wrapper

Returns a new instance of Wrapper.



10
11
12
13
# File 'lib/jsapi/meta/response/wrapper.rb', line 10

def initialize(response, definitions)
  @locale = response.resolve_lazily(definitions).locale
  super
end

Instance Attribute Details

#localeObject (readonly)

The locale of the wrapped response or reference.



8
9
10
# File 'lib/jsapi/meta/response/wrapper.rb', line 8

def locale
  @locale
end

Instance Method Details

#media_type_and_content_for(*media_ranges) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/jsapi/meta/response/wrapper.rb', line 15

def media_type_and_content_for(*media_ranges)
  super&.then do |media_type_and_content|
    [
      media_type_and_content.first,
      Content.wrap(media_type_and_content.second, definitions)
    ]
  end
end