Class: JSONResponse::JSONStruct
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- JSONResponse::JSONStruct
- Defined in:
- lib/json_response.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(&block) ⇒ JSONStruct
constructor
A new instance of JSONStruct.
- #next(name) ⇒ Object
Constructor Details
#initialize(&block) ⇒ JSONStruct
Returns a new instance of JSONStruct.
17 18 19 20 |
# File 'lib/json_response.rb', line 17 def initialize(&block) super @block = block end |
Instance Method Details
#build ⇒ Object
26 27 28 |
# File 'lib/json_response.rb', line 26 def build self.tap { |s| @block.call(s) }.marshal_dump end |
#next(name) ⇒ Object
22 23 24 |
# File 'lib/json_response.rb', line 22 def next(name) JSONResponse.next(name) end |