Class: SimpleParams::ApiPieDoc::NestedAttribute
- Inherits:
-
AttributeBase
- Object
- AttributeBase
- SimpleParams::ApiPieDoc::NestedAttribute
- Defined in:
- lib/simple_params/api_pie_doc/nested_attribute.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Attributes inherited from AttributeBase
Instance Method Summary collapse
-
#initialize(simple_params_attribute) ⇒ NestedAttribute
constructor
A new instance of NestedAttribute.
- #name ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(simple_params_attribute) ⇒ NestedAttribute
Returns a new instance of NestedAttribute.
6 7 8 9 10 |
# File 'lib/simple_params/api_pie_doc/nested_attribute.rb', line 6 def initialize(simple_params_attribute) super self.attributes = attribute.values[0].map { |attribute| ApiPieDoc::Attribute.new(attribute) } self. ||= attribute.delete(:options) || attribute[1] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/simple_params/api_pie_doc/nested_attribute.rb', line 4 def attributes @attributes end |
Instance Method Details
#name ⇒ Object
12 13 14 |
# File 'lib/simple_params/api_pie_doc/nested_attribute.rb', line 12 def name attribute.keys.first.to_s end |
#to_s ⇒ Object
16 17 18 19 |
# File 'lib/simple_params/api_pie_doc/nested_attribute.rb', line 16 def to_s return nil if do_not_document? nested_description end |