Class: EasyApiDoc::Parameter
- Inherits:
-
Object
- Object
- EasyApiDoc::Parameter
- Includes:
- Configurable
- Defined in:
- app/models/easy_api_doc/parameter.rb
Instance Attribute Summary collapse
-
#field_name ⇒ Object
Returns the value of attribute field_name.
Instance Method Summary collapse
-
#initialize(*params) ⇒ Parameter
constructor
A new instance of Parameter.
- #nested? ⇒ Boolean
- #parameters ⇒ Object
- #scope_level ⇒ Object
Methods included from Configurable
#[], #[]=, #defaults, included, #inherited_overridable, #load_children
Constructor Details
#initialize(*params) ⇒ Parameter
Returns a new instance of Parameter.
7 8 9 10 |
# File 'app/models/easy_api_doc/parameter.rb', line 7 def initialize(*params) super(*params) set_field_name end |
Instance Attribute Details
#field_name ⇒ Object
Returns the value of attribute field_name.
5 6 7 |
# File 'app/models/easy_api_doc/parameter.rb', line 5 def field_name @field_name end |
Instance Method Details
#nested? ⇒ Boolean
12 13 14 |
# File 'app/models/easy_api_doc/parameter.rb', line 12 def nested? self['type'] == nil end |
#parameters ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/models/easy_api_doc/parameter.rb', line 16 def parameters return [] unless nested? return @parameters if @parameters field_namespace = @field_namespace || [] field_namespace << @name @parameters = load_children(EasyApiDoc::Parameter, nil, {:extra_attributes => {'field_namespace' => field_namespace}}) end |
#scope_level ⇒ Object
24 25 26 |
# File 'app/models/easy_api_doc/parameter.rb', line 24 def scope_level (@attributes['field_namespace'] || []).size end |