class Apipie::Generator::Swagger::TypeExtractor
Constants
- TYPES
Public Class Methods
new(validator)
click to toggle source
@param [Apipie::Validator::BaseValidator, ResponseDescriptionAdapter::PropDesc::Validator, nil] validator
# File lib/apipie/generator/swagger/type_extractor.rb, line 24 def initialize(validator) @validator = validator end
Public Instance Methods
extract()
click to toggle source
# File lib/apipie/generator/swagger/type_extractor.rb, line 28 def extract expected_type = if string? :string elsif enum? :enum else @validator.expected_type.to_sym end TYPES[expected_type] || @validator.expected_type end
Private Instance Methods
enum?()
click to toggle source
# File lib/apipie/generator/swagger/type_extractor.rb, line 47 def enum? @validator.is_a?(Apipie::Validator::EnumValidator) || (@validator.respond_to?(:is_enum?) && @validator.is_enum?) end
string?()
click to toggle source
# File lib/apipie/generator/swagger/type_extractor.rb, line 43 def string? @validator.blank? end