Class: ApiSketch::ResponseRenderer
- Inherits:
-
Object
- Object
- ApiSketch::ResponseRenderer
- Defined in:
- lib/api_sketch/response_renderer.rb
Instance Attribute Summary collapse
-
#container_type ⇒ Object
readonly
Returns the value of attribute container_type.
-
#elements_count ⇒ Object
readonly
Returns the value of attribute elements_count.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(params, container_type, elements_count) ⇒ ResponseRenderer
constructor
A new instance of ResponseRenderer.
- #to_h ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(params, container_type, elements_count) ⇒ ResponseRenderer
Returns a new instance of ResponseRenderer.
5 6 7 8 9 |
# File 'lib/api_sketch/response_renderer.rb', line 5 def initialize(params, container_type, elements_count) @params = params || {} @container_type = container_type @elements_count = elements_count > 0 ? elements_count : 3 end |
Instance Attribute Details
#container_type ⇒ Object (readonly)
Returns the value of attribute container_type.
3 4 5 |
# File 'lib/api_sketch/response_renderer.rb', line 3 def container_type @container_type end |
#elements_count ⇒ Object (readonly)
Returns the value of attribute elements_count.
3 4 5 |
# File 'lib/api_sketch/response_renderer.rb', line 3 def elements_count @elements_count end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/api_sketch/response_renderer.rb', line 3 def params @params end |
Instance Method Details
#to_h ⇒ Object
11 12 13 |
# File 'lib/api_sketch/response_renderer.rb', line 11 def to_h render_content(params, container_type) end |
#to_json ⇒ Object
15 16 17 |
# File 'lib/api_sketch/response_renderer.rb', line 15 def to_json self.to_h.to_json end |