Class: JSONResponse::JSONStruct

Inherits:
Object
  • 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
# File 'lib/json_response.rb', line 17

def initialize(&block)
  @block = block
end

Instance Method Details

#buildObject



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