Class: Jsapi::Controller::Response::HashReader
- Inherits:
-
Object
- Object
- Jsapi::Controller::Response::HashReader
- Defined in:
- lib/jsapi/controller/response.rb
Overview
:nodoc:
Instance Method Summary collapse
- #[](key) ⇒ Object
- #additional_properties ⇒ Object
-
#initialize(hash) ⇒ HashReader
constructor
A new instance of HashReader.
Constructor Details
#initialize(hash) ⇒ HashReader
Returns a new instance of HashReader.
21 22 23 |
# File 'lib/jsapi/controller/response.rb', line 21 def initialize(hash) @hash = hash end |
Instance Method Details
#[](key) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/jsapi/controller/response.rb', line 25 def [](key) return unless @hash.key?(key) (@read_keys ||= []) << key @hash[key] end |
#additional_properties ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/jsapi/controller/response.rb', line 32 def additional_properties if @hash.key?('additional_properties') @hash['additional_properties'] elsif @hash.key?(:additional_properties) @hash[:additional_properties] elsif @read_keys @hash.except(*@read_keys) else @hash end end |