Class: JSONResponse::JSONStruct

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/json_response.rb

Instance Method Summary collapse

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

#buildObject



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