Class: GrapeApiary::Parameter
- Inherits:
-
Object
- Object
- GrapeApiary::Parameter
- Defined in:
- lib/grape-apiary/parameter.rb
Instance Attribute Summary collapse
-
#full_name ⇒ Object
readonly
Returns the value of attribute full_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#route ⇒ Object
readonly
Returns the value of attribute route.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
- #desc ⇒ Object
- #description ⇒ Object
- #documentation ⇒ Object
- #example ⇒ Object
-
#initialize(route, name, options) ⇒ Parameter
constructor
A new instance of Parameter.
- #requirement ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(route, name, options) ⇒ Parameter
Returns a new instance of Parameter.
7 8 9 10 11 12 13 |
# File 'lib/grape-apiary/parameter.rb', line 7 def initialize(route, name, ) @full_name = name @name = name @name = name.scan(/\[(.*)\]/).flatten.first if name.include?('[') @route = route @settings = () end |
Instance Attribute Details
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
3 4 5 |
# File 'lib/grape-apiary/parameter.rb', line 3 def full_name @full_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/grape-apiary/parameter.rb', line 3 def name @name end |
#route ⇒ Object (readonly)
Returns the value of attribute route.
3 4 5 |
# File 'lib/grape-apiary/parameter.rb', line 3 def route @route end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
3 4 5 |
# File 'lib/grape-apiary/parameter.rb', line 3 def settings @settings end |
Instance Method Details
#desc ⇒ Object
23 24 25 |
# File 'lib/grape-apiary/parameter.rb', line 23 def desc settings[:desc] end |
#description ⇒ Object
35 36 37 |
# File 'lib/grape-apiary/parameter.rb', line 35 def description "#{name} (#{requirement}, #{type}, `#{example}`) ... #{desc}" end |
#documentation ⇒ Object
27 28 29 |
# File 'lib/grape-apiary/parameter.rb', line 27 def documentation settings[:documentation] end |
#example ⇒ Object
31 32 33 |
# File 'lib/grape-apiary/parameter.rb', line 31 def example documentation ? documentation[:example] : nil end |
#requirement ⇒ Object
15 16 17 |
# File 'lib/grape-apiary/parameter.rb', line 15 def requirement settings[:requirement] end |
#type ⇒ Object
19 20 21 |
# File 'lib/grape-apiary/parameter.rb', line 19 def type settings[:type] end |