Class: JSONResponse::JSONStruct
- Inherits:
-
Object
- Object
- 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 |
# File 'lib/json_response.rb', line 17 def initialize(&block) @block = block end |
Instance Method Details
#build ⇒ Object
25 26 27 |
# File 'lib/json_response.rb', line 25 def build OpenStruct.new.tap { |o| @block.call(o) }.marshal_dump end |
#next(name) ⇒ Object
21 22 23 |
# File 'lib/json_response.rb', line 21 def next(name) JSONResponse.next(name) end |