Class: SimpleParams::ApiPieDoc
- Inherits:
-
Object
- Object
- SimpleParams::ApiPieDoc
- Defined in:
- lib/simple_params/api_pie_doc.rb
Defined Under Namespace
Classes: Attribute, AttributeBase, NestedArray, NestedAttribute
Instance Attribute Summary collapse
-
#base_attributes ⇒ Object
Returns the value of attribute base_attributes.
-
#docs ⇒ Object
Returns the value of attribute docs.
-
#nested_array_attributes ⇒ Object
Returns the value of attribute nested_array_attributes.
-
#nested_arrays ⇒ Object
Returns the value of attribute nested_arrays.
-
#nested_attributes ⇒ Object
Returns the value of attribute nested_attributes.
-
#nested_hashes ⇒ Object
Returns the value of attribute nested_hashes.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(simple_params) ⇒ ApiPieDoc
constructor
A new instance of ApiPieDoc.
Constructor Details
#initialize(simple_params) ⇒ ApiPieDoc
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/simple_params/api_pie_doc.rb', line 11 def initialize(simple_params) self.base_attributes = simple_params.defined_attributes self.nested_hashes = simple_params.nested_hashes self.nested_arrays = simple_params.nested_arrays self.nested_attributes = [] self.nested_array_attributes = [] self.docs = [] build_nested_attributes build_nested_array_attributes end |
Instance Attribute Details
#base_attributes ⇒ Object
Returns the value of attribute base_attributes.
4 5 6 |
# File 'lib/simple_params/api_pie_doc.rb', line 4 def base_attributes @base_attributes end |
#docs ⇒ Object
Returns the value of attribute docs.
4 5 6 |
# File 'lib/simple_params/api_pie_doc.rb', line 4 def docs @docs end |
#nested_array_attributes ⇒ Object
Returns the value of attribute nested_array_attributes.
4 5 6 |
# File 'lib/simple_params/api_pie_doc.rb', line 4 def nested_array_attributes @nested_array_attributes end |
#nested_arrays ⇒ Object
Returns the value of attribute nested_arrays.
4 5 6 |
# File 'lib/simple_params/api_pie_doc.rb', line 4 def nested_arrays @nested_arrays end |
#nested_attributes ⇒ Object
Returns the value of attribute nested_attributes.
4 5 6 |
# File 'lib/simple_params/api_pie_doc.rb', line 4 def nested_attributes @nested_attributes end |
#nested_hashes ⇒ Object
Returns the value of attribute nested_hashes.
4 5 6 |
# File 'lib/simple_params/api_pie_doc.rb', line 4 def nested_hashes @nested_hashes end |
Instance Method Details
#build ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/simple_params/api_pie_doc.rb', line 23 def build base_attributes.each do |attribute| docs << Attribute.new(attribute).to_s end nested_attributes.each do |nested_attribute| docs << NestedAttribute.new(nested_attribute).to_s end nested_array_attributes.each do |nested_attribute| docs << NestedArray.new(nested_attribute).to_s end docs.join("\n") end |