Class: Apipie::ResponseDescriptionAdapter::PropDesc::Validator
- Inherits:
-
Object
- Object
- Apipie::ResponseDescriptionAdapter::PropDesc::Validator
- Defined in:
- lib/apipie/response_description_adapter.rb
Overview
a ResponseDescriptionAdapter::PropDesc::Validator pretends to be an Apipie::Validator
Instance Attribute Summary collapse
-
#expected_type ⇒ Object
readonly
Returns the value of attribute expected_type.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(expected_type, enum_values = nil, sub_properties = nil) ⇒ Validator
constructor
A new instance of Validator.
- #is_enum? ⇒ Boolean
- #params_ordered ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(expected_type, enum_values = nil, sub_properties = nil) ⇒ Validator
Returns a new instance of Validator.
63 64 65 66 67 68 |
# File 'lib/apipie/response_description_adapter.rb', line 63 def initialize(expected_type, enum_values = nil, sub_properties = nil) @expected_type = expected_type @enum_values = enum_values @is_enum = !!enum_values @sub_properties = sub_properties end |
Instance Attribute Details
#expected_type ⇒ Object (readonly)
Returns the value of attribute expected_type.
57 58 59 |
# File 'lib/apipie/response_description_adapter.rb', line 57 def expected_type @expected_type end |
Instance Method Details
#[](key) ⇒ Object
59 60 61 |
# File 'lib/apipie/response_description_adapter.rb', line 59 def [](key) self.send(key) if self.respond_to?(key.to_s) end |
#is_enum? ⇒ Boolean
70 71 72 |
# File 'lib/apipie/response_description_adapter.rb', line 70 def is_enum? !!@is_enum end |
#params_ordered ⇒ Object
78 79 80 81 |
# File 'lib/apipie/response_description_adapter.rb', line 78 def params_ordered raise "Only validators with expected_type 'object' can have sub-properties" unless @expected_type == 'object' @sub_properties end |
#values ⇒ Object
74 75 76 |
# File 'lib/apipie/response_description_adapter.rb', line 74 def values @enum_values end |