Class: ApipieBindings::Param
- Inherits:
-
Object
- Object
- ApipieBindings::Param
- Defined in:
- lib/apipie_bindings/param.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#expected_type ⇒ Object
readonly
Returns the value of attribute expected_type.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#validator ⇒ Object
readonly
Returns the value of attribute validator.
Instance Method Summary collapse
-
#initialize(param) ⇒ Param
constructor
A new instance of Param.
- #inspect ⇒ Object
- #required? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(param) ⇒ Param
Returns a new instance of Param.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/apipie_bindings/param.rb', line 7 def initialize(param) param = ApipieBindings::IndifferentHash.new(param) @name = param[:name] params = param[:params] || [] @params = params.map { |p| ApipieBindings::Param.new(p) } @expected_type = param[:expected_type].to_sym @description = param[:description].gsub(/<\/?[^>]+?>/, "") @required = !!param[:required] @validator = param[:validator] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/apipie_bindings/param.rb', line 5 def description @description end |
#expected_type ⇒ Object (readonly)
Returns the value of attribute expected_type.
5 6 7 |
# File 'lib/apipie_bindings/param.rb', line 5 def expected_type @expected_type end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/apipie_bindings/param.rb', line 5 def name @name end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'lib/apipie_bindings/param.rb', line 5 def params @params end |
#validator ⇒ Object (readonly)
Returns the value of attribute validator.
5 6 7 |
# File 'lib/apipie_bindings/param.rb', line 5 def validator @validator end |
Instance Method Details
#inspect ⇒ Object
26 27 28 |
# File 'lib/apipie_bindings/param.rb', line 26 def inspect to_s end |
#required? ⇒ Boolean
18 19 20 |
# File 'lib/apipie_bindings/param.rb', line 18 def required? @required end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/apipie_bindings/param.rb', line 22 def to_s "<Param #{ required? ? '*' : '' }#{@name} (#{@expected_type.to_s.capitalize})>" end |